My Sql Database Help?

free web hosting
Free Web Hosting > Computers & Tech > Databases

My Sql Database Help?

shnabo11
Ok, i am new at web design, i dont know too much about it... I was working on a website for about a month this is what i got, My Web , like i said, i dont know much.. i used FrontPage and did all of that, my current host is AFMU which uses MySQL, but the way it is set up I dont know how to acquire the URL of the database or any information i dont know what it means at all.. i just want to do a simple login feature, i mean this is my first website and i am learning so I think it would be a great feature to add in and learn. i can create data bases from there but do not know what to do afterwards, example: I Create a database name and a user this is what it leaves me with; NOTE! I did not change ANYTHING listed below, this is EXACTLY what it created for me, now that i got that off my chest, here it is:
CODE
Current Databases:
deatncom_logindb  
Users in logindb
deatncom_shnabo (Privileges: ALL PRIVILEGES)

Connection Strings
Perl $dbh = DBI->connect("DBI:mysql:deatncom_logindb:localhost","deatncom_shnabo","<PASSWORD HERE>");
PHP $dbh=mysql_connect ("localhost", "deatncom_shnabo", "<PASSWORD HERE>") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("deatncom_logindb");


Could some on please tell me how i use this information??? please..

I appreciate the time you took to read this, and if you know what to do please post, thank you very much

 

 

 


Reply

pyost
In order to connect a web site with a MySQL database, you will need to know more about web development than just using Microsoft FrontPage - you will also need to learn PHP (or ASP, but the former is a better option). However, prior to doing so, it would also be a good idea to start dealing with HTML code instead of using a WYSIWYG (What You See Is What You Get) editor (e.g. FrontPage, Dreamweaver). Be aware that PHP isn't easy, and that it will take at least a month of regular practice for you to be able to create a hack-proof and secure login system.

If all this looks like a too big step to you, there is always the option of using a CMS (Content Management System) for your web site. These are great because they offer easy content management along with a user-friendly interface, as well as a registrations system (in most cases). I must warn you, though, that this option too requires a little HTML/PHP knowledge in order to use it to its full potential. Even if you do decide on the first one, examining how a certain CMS works is a great way of learning new things. Or at least that is my experience smile.gif

 

 

 


Reply

Arbitrary
Pyost is right--you definitely need more than just FrontPage.

Okay, if you've already created a database, then just paste the code that was given to you in a file. I'll go with PHP for now:

CODE
PHP $dbh=mysql_connect ("localhost", "deatncom_shnabo", "<PASSWORD HERE>") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("deatncom_logindb");

Paste this in a .php file and replace <PASSWORD HERE> with the password you specified while creating the database. Once you run the file, the database connection will be opened. Also remember to put <?php and ?> around the PHP code.

Then, afterwards, you want to create a table in the database to hold your login information. (Use PhpMyAdmin if you're using MySQL) You could go with three fields (username, password, email, id) for a very very simple user registration. For the username, password, and email you should leave the field type as varchar with a length of your choice. For the id, use a type of int and set it as a primary key. Also, under extras, set the id to 'auto_increment'. The id is mostly for internal tracking purposes and won't be of much use to the end-user.

Under the different options, you shouldn't need to touch collation, attributes, and null. Default you can set if you want there to be a default value for each field. (Not really applicable in your situation, I think)

Clicking save should also generate PHP code that can be used to create the exact same table if you paste it in a php file.

Then, in order to access the table, you should use mysql. First you'd want to create a registration page (let's say called register.php). In it you'd have:

CODE
<form action="register.php" method="post">
<label for="username">Username: </label>
<input type="text" name="firstname"><br />
<label for="password">Password: </label>
<input type="password" name="password"><br />
<label for="email">Email: </label>
<input type="text" name="email"><br />
</form>


As a side note, I typed this in the browser, so there's no guarantee it'll work right off the bat. Now, to break apart the tags within <form></form>...

[a] the action attribute within <form> -- this is where the form directs to, and it's also where you want to put the php code to execute data received from the form
[b] the method attribute within <form> -- this tells the browser how to send the information. It can either be POST or GET. If it's GET, the data will appear in a website's url--ex: www.example.com/something.php?actid=5 If it's POST, the data is hidden. For something sensitive like registration or logging in, POST should always be the one used
[c] the name attribute in the input tag -- this is the name that's used by PHP to access the data--you'll see later.

Moving on...

Now, to access the form data that a user has entered, in register.php we'd want to have:

CODE
<?php
$username = $_POST["username"];
$email= $_POST["email"];
$password= $_POST["password"];
?>


Suppose the user entered helpless as the username, iowf83M as the password and weoiwho@gmail.com as the email. Then the variables $username, $email, and $password should contain the respective data. The array variable $_POST is defined by PHP to access data from a form with a method of POST. The ["username"] part of the variable is the value defined in name in the input tag.

Before you do anything with the password, you should md5 has it for security purposes. Ex:

CODE
<?php
$password = md5($password);
?>

md5 is a (nice) built-in function in php that does what it says.

Once you've got the data within variables and hashed accordingly, you'd want to use this to insert the data into the database:

CODE
<?php
mysql_query("INSERT INTO <table_name> (username, password, email)
VALUES ('$username', '$password', '$email')");
?>


To break the mysql query down, INSERT INTO is very obvious. Replace <table_name> with the name of your table. (Most likely users or something like that). The stuff between the parentheses are the fields you want to insert into--username, password and email. The values correspond to their respective fields.

Now that the data is in the database, to retrieve it, we use another mysql query.
CODE
$username = $_POST["username"];
$email= $_POST["email"];
$password= $_POST["password"];

$result = mysql_query("SELECT * FROM users WHERE username='$username' AND password='$password'");


The select query gets the user where username is the username entered and password is the password entered. If $result exists, then the user can be logged in.

This is the most basic aspects of a login system, and it's not even fully complete yet. For a secure login system, check out http://www.devshed.com/c/a/PHP/Creating-a-...P-Login-Script/ . Of course, you'd need stripslashes to make sure that sql injections won't work. And as incoherent last words, it's best to use a framework for larger projects (I recommend CakePHP)

Reply

yordan
Thanks to Arbitrary for this very complete introduction.
I would also add a suggestion.
If you are hosted here at astahost, and if you like "learn-by-example", I would suggest you to use the Astahost's "Fantastico" facility, and install a phpbb forum or a 4image gallery, have a look at the sources generated, and see how they manage the database connection and user/passwords handling.
I really think that looking at other people's programs help understanding a lot.
And, of course, having a working system, which correctly connects to a correctly database, is really helpful.
Then, comparing the working scripts to your faulty scripts could help correcting your errors.
And, of course, when you will be grown, you will start writing down your own programs from scratch, and they will be far better than any examples that could be provided.
Regards
Yordan

Reply


Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.

Similar Topics

Keywords : sql, database,

  1. Sql*plus On Your Pc
    Connecting to a remote database (3)
  2. Free Or Opensource Database/schema Browser?
    Alternatives to TOAD or PL/SQL Developer (6)
    I was wondering if there were any alternatives to TOAD or PL/SQL Developer that allows you to browse
    through a database(s), the different schema objects, and perhaps the stored
    procedure/function/packakge editors. One thing I have tried is to the use the Data Tool Plugins set
    for my Eclipse but that brings my machine's performance to crawl. One a further note, I am
    basically looking for Windows environment, with connections to remoate databases.....
  3. How To Understand A Database Schema
    A very nice and simple tutorial (4)
    Yesterday while i'm seaching for a data model and database schema at the Library of Free Data
    Models for a new project of a friend of mine i found there this nice and simple tutorial on How to
    Understand a Database Schema . As its name says, this tutorial will help you to better understand a
    Database Schema and covers the following basics topics that every Database Schema must define:
    QUOTE Primary and Foreign Keys. One-to-Many and Many-to-Many Relationships. Inheritance.
    "Rabbit's Ears", (Recursive relationships). The Scope of this tutorial is ....
  4. Best Database
    (13)
    What is the best free database if some one trying built a social networking website? And how to
    operate it with dreamweaver 8?....
  5. Database
    (7)
    $c = mysql_connect('localhost', 'root', 'p1kap1ka');
    mysql_select_db('lite2', $c); $mykey=256573440; ?> In this code where shall I post
    my database name (and my database name should it contain my hosting name so before it there should
    be a165_game For example? or should it just be game?) and where shall I put the user password?....
  6. Some Useful Database Links.
    (7)
    I thought I would take a moment to point the users here to some of the database resources available
    for reference and learning. First I will start with actually designing the database. This site by
    R937 covers the basics of database design. The author is professional database guru and a frequent
    helper at the at DB forums listed below. The Library of Free Data Models is an excellent
    resource for finding data models for projects you may have or as examples of well put together data
    models. With around 500 data models the chances are you find something at least cl....
  7. Database Access On Remote Server W/jsp
    (0)
    Hello: I am new to JAVA and server-side applications and have a dumb question. I have set up
    Tomcat on my machine and created a JSP program to query an Access database using a DSN-Less
    connection. If I publish the page to a webserver and include the .MDB file will it work? I'm
    not sure exactly what needs to be packaged with my Java application to make it work. Since I
    don't have a remote server that supports .jsp I cannot really test it. I'm assuming that
    JDBC driver would be bundled with my site but not sure. Thanks!....
  8. Space Needed For Database
    (10)
    Iam assuming the information in the databases i will create will be stored in the 500 MB space i
    get, but since 500MB isn't enough iam wondering if you guys can tell me how much bytes the
    following take: Varchar(x),Tinyint,Text,date,smallint,mediumint,bigint,float.... And the rest
    present when you add/edit a row in a table. Also what are the ranges of tinyint,smallint,mediumint
    and big int....
  9. Mysql Database Entry By Excel Sheets
    (2)
    Hello .. I would like to ask if i can use use Microsoft excel files in order to make entries to
    mysql database. Thanks....
  10. Mysql Database Management
    (1)
    Hi i am new, I have a problem in understanding the query decomposition in D-DB. Can anyone help me
    to understand the first question of the exercise 25.21 of Elmasri-Navath 4th edition? Consider the
    following relations: BOOKS (Book#, Primary_author, Topic, Total_stock, $price) BOOKSTORE (Store#,
    City, State, Zip, Inventory_value) STOCK (Store#, Book#, Qty) Consider a distributed database for a
    bookstore chain called National Books with 3 sites called EAST, MIDDLE, and WEST. Consider that
    BOOKS are fragmented by $price amounts into: B1:BOOK1:up to $20. B2:BOOK2:from ....
  11. Accessing Ms Access Database From A Centralized Location?
    (5)
    Hi I am a manager at a trading/wholesaling company (and have no programming background). I
    customized the Northwind sample access database to make invoices and keep accounts for my company.
    We now opening another office at a distant location. So, the order entry will be done at two
    points(we plan to use the same Access database). I am not able to figure out how to access the same
    MS Access database from two different location(as LAN can't be used). Moreover, we can't
    afford to pay huge sums to the software developers. Can intranet or uploading the database t....
  12. Integrate Access Database Onto Intranet Site
    Looking to integrate access database into my intranet site (5)
    Hey guys, im new here and am looking for answers /tongue.gif" style="vertical-align:middle"
    emoid=":P" border="0" alt="tongue.gif" /> Firstly, i have designed a database using M$ access, it
    consists of multiple forms which i plan to host on an intranet website, i need to be able to add
    records directly from the form on the intranet website aswell as being able to edit/review current
    entries on forms in the database. My question is, how would i go about integrating these forms onto
    the intranet website? i plan on keeping the database and the intranet site on the same d....
  13. Database
    prblem with it (1)
    i have free script but it is working fine on a lot of sites i tried to use it to my web site ....i
    edit its config.php right and but my database name and my user name and password every thing right
    and when i try to install it it gives me this error can`t connect to database please choose file
    from this mobile.sql can any body help plz coz i tried huderd of times and no thing happend....
  14. Connecting To A Remote Database
    (9)
    I wondered if anyone here can help. I have a database on a remote server (A). I want to access it
    through a php script on a different server C. I have allowed access on (A) in Cpanel - mysql dbases
    - Remote Access by putting the IP address of server C The host of server (A) has also whitelisted
    the IP of server C. Though I am having trouble connecting from server C which is with a different
    webhost. any ideas how to get round this? I have though of SSH forwarding, but I think this can
    only be used to connect a client - e.g. my pc to the remote server A. I do not ha....
  15. Api And Http Or Database?
    (0)
    Hey folks! I've got a question... I'm looking at developing a website that generates its
    content based on an XML feed from an API call. My question to you is, what's more efficient,
    constantly making API calls and downloading a lot of information, or saving calls to a database and
    recalling them when needed? See, I'm not sure how many requests will be served NOR am I sure
    how often the API sources will be updated... is there a place where a line gets crossed and says a
    database would be better than constant API calls? Thanks, Jared....
  16. How To Make A Value In The Database Raise Every Minute.
    (50)
    Hi. I am trying to figure out how to make a value in the database raise every minute. Lets say, I
    want the HP to raise every minute. The max HP is 100. I want it to raise 5 HP/ Hour. And the player
    don't have to be online. Anyone who know how I can do it =? Thanks for any help. //Feelay....
  17. Can't Select Database =?
    It works on my home PC (3)
    Hey! I've made a register script. It works on my home pc, but when I upload it to astahost, it
    don't work =/ This is the error meesage I am getting: Warning: mysql_num_rows(): supplied
    argument is not a valid MySQL result resource in /home/feelay/public_html/regcheck.php on line 35
    You Could Not Register Because Of An Unexpected Error. Error: No database selected I know the
    error is from the database.. But I don't know exactly how the astahost database works.. My
    username is feelay_myname i think, and the databasename should be feelay_thedatabasename. Bu....
  18. Need Help In Database Auto_increment
    (9)
    i am creating a game and i set when someone registers than he gets id...in "extra" i have set it to
    be "auto_increment" but whenever new player signs up he gets number bigger than 210...(my first id
    was 211,next was 212,third was 213,fourth got 214) how to set it to go from 1 to infinite? thnx....
  19. Five Common Php Database Problems
    (0)
    I just read this excelent article from the IBM's developerWorks website, it's name is Five
    common PHP database problems . This article shows five database problems that occur in PHP
    applications as well as their solutions and include database schema design, database access, and the
    business logic code that uses the database. It is a bit older -a year ago more or less- but i
    think that can be helpful for everybody that works with PHP and MySql. Best regards,....
  20. Ajax + Php + Sql = Simply Superb! ( With Visitor Tracking )
    A small tutorial to explain integrating php, ajax and MySQL Database (11)
    Hi all.. I'm back with a new small tutorial! Introducation A tutorial to integrate
    Ajax, Php And Database ( Im using MySQL) + Visitor Tracking! Here you can enter values to some
    input fields, and by clicking some enter button, ( or u can call the function on some other event)
    those values will be sent to the database, along with visitor details ( IP Address, Input Value,
    Visitor Agent etc)! Those values will be stored in some database and you can retrieve the same using
    some simple php code and even deleted some rows from those databases! Requiremen....
  21. Permission Problem With Mysql Database Creation
    Please Help! (8)
    I seem to have a problem with accessing my database with proper permissions. I have set the my
    database correctly giving my db username all priviliges yet i seem to be unable to even log on with
    this username with a denied access error. Any ideas on resolving this?....
  22. Is It A Good Practice To Store Image Or Other Binary Files Directly In A Mysql Database
    (4)
    Hello to all of you beautifull people out there, I am new to MySQL, i just wanted to know if its a
    good practice to directly store images and other binary files in a MySQL database. Any one with
    help? Thanks....
  23. MySQL Output Database Question
    (18)
    I am new to MySql and have just created a database after using a script. My problem is not the
    script, but what it says about putting it into the output file. I cant figure out the right terms
    to put it in, I keep getting errors. I try using; SELECT*FROM 'database name' WHERE
    'location' but it isnt working. I'm lost with this stuff, I really am. Can someone
    please help me out?....
  24. Need Help With A PHP - MySQL Registration Script
    Wont INSERT into the database (13)
    hey well can some one helpme make this code work it won't INSERT INTO THE DATABSE CODE #
    register1.php # common include file to MySQL include("DB.PHP"); $Username=$_POST ; $Password=$_POST
    ; $Name=$_POST ; $Last=$_POST ; $Sex=$_POST ; $Month=$_POST ; $Day=$_POST ; $Year=$_POST ;
    $Adresse=$_POST ; $City=$_POST ; $State=$_POST ; $Zipcode=$_POST ; $Country=$_POST ; $Phone=$_POST ;
    $Email=$_POST ; $Father_Name=$_POST ; $Mother_Name=$_POST ; $Parent_Phone=$_POST ;
    $Parent_Email=$_POST ; $Level=$_POST ; $Academic=$_POST ; $Image_Link=$_POST ; $sql9="INSERT INTO
    U....
  25. The Best Database
    What do you think is the best database? (48)
    Ive been planning to create a online application which requires tons of stuff from database. Ive
    been using interbase, at first it was good but after a month i find it not user friendly at all...
    Its to hard to code in php.. Can any of you guys give me a good database which is easy to use?....
  26. How To: Connect, Read, Write, Close A Database
    VB.NET (5)
    Here is a tutoral or a novice programmer. This tutorial assumes you have a basic knoladge of
    databases and VB.NET. It also assumes that you have a MS access database named Testdb.mdb with a
    table called "Table1" that has at least one column called "Col1". You must start with a form with
    one label on it. If you need any help email me at bob3695@gmail.com. The first step is connecting
    to the database. The first thing you must do is add the ADODB reference. To do this in the
    "Project" menu click "Add Reference" then select ADODB from the list and click "Select". The next....
  27. Mirror My MySQL Database To Another Mysql Server
    (4)
    Hi..I want to ask if its possible to automatically mirror my mysql databases into another mysql
    server?or create a small php script to do this? The reason is because, we all know that database is
    very improtant if we have dynamic website. I have my forum hosted and i want to automatically
    mirror this or backup into another mysql server(free). Like in freesql.org. So that im not afraid
    that i forgot to backup my database..also i have one central backup database. Thanks for the
    help..Im looking forward for this posibility.....
  28. Need Advice On Creating Online Music Database
    ps - dont know anything about databases! (6)
    I need to create a database of around 1000 music albums that I can put on my site, with the ability
    to search the database according to several different criteria. Being a complete and total NOOB to
    the world of databases, can anyone point me in the direction of some software that will let me
    create a good-looking and functional database, but that isn't too complicated for me to use?!
    Sounds like a tall order I know, be grateful if anyone can help though. Thanks! Topic edited to
    reflect content better. ....
  29. Creating A Game In Rpg Maker 2000/2003
    Part 1 - New Game and the Database (18)
    Creating a game in RPG Maker 2000/2003 Part 1 (I AM ONLY GOING TO TEACH YOU HOW TO MAKE AN
    RPG GAME IN THIS TUTORIAL!) First of all, you need to find some resources. When I say resources, I
    mean Character Sets, Chip Sets, Music, Backdrops, and Enemies. (Also others) The perfect place to
    find thoses would be at one of these great websites: www.gamingw.net www.phylomortis.com But,
    before you save them, you need to create a new game. Once you click on "New Project", this screen
    will pop up. The Directory Name is simply the name of the folder that it will mak....
  30. Embedded Database
    Embedded Data base at client side, (7)
    Hi, Now its the era of Embedded databases, no more db servers, no more host,Because with embedded
    db you can get all those options, what you are used to get with DB Servers. Some of Embedded DB Are
    1) Cloudscape From IBM (NOW Derby from ASF) 2) HSQLDB (OpenSource) and many more Feel the power of
    EDB Cheers Arunkumar.H.G....

    1. Looking for sql, database,






*SIMILAR VIDEOS*
Searching Video's for sql, database,
Similar
Sql*plus On Your Pc - Connecting to a remote database
Free Or Opensource Database/schema Browser? - Alternatives to TOAD or PL/SQL Developer
How To Understand A Database Schema - A very nice and simple tutorial
Best Database
Database
Some Useful Database Links.
Database Access On Remote Server W/jsp
Space Needed For Database
Mysql Database Entry By Excel Sheets
Mysql Database Management
Accessing Ms Access Database From A Centralized Location?
Integrate Access Database Onto Intranet Site - Looking to integrate access database into my intranet site
Database - prblem with it
Connecting To A Remote Database
Api And Http Or Database?
How To Make A Value In The Database Raise Every Minute.
Can't Select Database =? - It works on my home PC
Need Help In Database Auto_increment
Five Common Php Database Problems
Ajax + Php + Sql = Simply Superb! ( With Visitor Tracking ) - A small tutorial to explain integrating php, ajax and MySQL Database
Permission Problem With Mysql Database Creation - Please Help!
Is It A Good Practice To Store Image Or Other Binary Files Directly In A Mysql Database
MySQL Output Database Question
Need Help With A PHP - MySQL Registration Script - Wont INSERT into the database
The Best Database - What do you think is the best database?
How To: Connect, Read, Write, Close A Database - VB.NET
Mirror My MySQL Database To Another Mysql Server
Need Advice On Creating Online Music Database - ps - dont know anything about databases!
Creating A Game In Rpg Maker 2000/2003 - Part 1 - New Game and the Database
Embedded Database - Embedded Data base at client side,
advertisement




My Sql Database Help?



 

 

 

 

ADD REPLY / Got an Opinion! a humble request :-) RAPID SEARCH! Free Hosting [X]
Express your Opinions, Thoughts or Contribute your information that might help someone here.
Ask your Doubts & Queries to get answers.. "Together, We enlight each other!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE