Not logged in
Home/Tutorials/New Database Tutorial
a year ago
New Database Tutorial
Content by: Steve Stewart
Posted a year ago with 6750 views
For this tutorial I've named mine "MyNewDatabase", you can call yours whatever you like.
I'm going to assume you have followed the "php mysqli Database Connect" tutorial and named you're database connection file as "dbconnection.php".
You can click on the images to view in new window...
We have our database, now let's add a table to it. I'm doing something simple by calling the table "siteinformation".
Do the same and call it siteinformation as later you'll see how we query for the results.
In the first column just put id followed by ticking the box for AI (AUTO INCRIMENT) and click "GO" with PRIMARY.
With our site information we are adding a name column, keywords and description. Notice: Name is VARCHAR 255 - Keywords is TEXT and so is Description.
So now we are going to add a user to the database with a password, it's best to generate a password unless you want do you're own that is.
Keep you're password safe.
Make sure that "Grand all Privileges on mynewdatabase" is showing "your" database name. The privileges for you're database to grant the user, we are going to select:
This is all you really need...
For testing we are going to add some information, click on you're database and Browse.
Click on "Insert" as we are doing this manually, as it's you're first row, id of 1 then fill in the rest.
I've added keywords with a comma, for meta tags.
Oncve you've followed the steps above you're now ready to connect to you're database and display the information.
Head on over to the Check Database & Generate Code page.
Check Database & Generate Code