6
2011
Mysql Database with PHP and HTML with search function Part 2
Setting up your database is relatively simple; keeping your login details close to hand, login to 000webhost.com. After setting up your host name (mine is bencraven.comyr.com) enter your Cpanel, and click MySql.
Under ‘create new database and user’, set the database name to ‘test’ (lower case) and the user name to ‘test’ (also lower case), remember your password.
Note: The service will provide you with a combination of characters prior to your user name and database name, this is fine, it will look something like ‘a6949157_test’ when you’re done.
Remember the following information when you’re finished! Note it down, you will use it in a couple of pages. It will look something like the following:
$mysql_host = “mysql6.000webhost.com”;
$mysql_database = “a6949157_test”;
$mysql_user = “a6949157_test”;
$mysql_password = “yourpassword”;
You’ve created a database! Next step is to set up a table. Go to your MySql page to manage your databases, you want to ‘enter phpmyadmin’, which is a hyperlink located in the paragraph of text above your database name. Click ‘Enter Phpmyadmin’ again on the next page. There are other options to phpmyadmin, but it is certainly one of the most commonly used, and comes with 000webhost, so… that’s good news.
For your table settings, choose Name: table1, and for number of fields choose 4. Then select ‘go’ and your first table will be created.
- Your details can all be different to the ones I’ve chosen, just remember what you choose, and relate back to earlier stages if you’re having problems with connecting.
- You don’t have to use the same number of fields either, just remember to include them in your form later.
Now, I won’t go through the differences between settings like Varchar now, there are a lot of them, I will write up a reference another time.
Set your first field name to ‘id’, your second to ‘fname’ third to ‘lname’ and fourth to ‘phone’. This should demonstrate 3 types of field. The id field will always be unique, so select ‘primary key’ of the selectable round icons on the right of the row, and set it’s ‘extra’ to ‘auto_increment’. You also want to change the ‘Type’ to ‘TINYINT’, which means tiny integer, referring to just numbers. Auto increment means when a new field is added, it lists it in ascending order by number, keeping it unique.
Set the following types for the remaining fields:
- fname – MEDTEXT
- lname – MEDTEXT
- phone – SMALLINT
Click ‘Save’ below, and your table is ready!
You should be redirected to something that looks like this:
When you’re ready, move on to page 3! Or, return to the previous page.
Related Posts
Leave a comment
Tutorials At A Glance
Recent Comments
BenTech RSS
- New Twitter Graphic Ben Craven
- Megavideo Is Not loading – Don’t Worry – It’s Not You! Ben Craven
- New Twitter Logos With Transparency Ben Craven
- Black Mirror Episode One Review Ben Craven
- Some Creative Vector Sky Scenery In Photoshop CS5 (Part 1) Ben Craven
- Recent WordPress Update Errors and How To Fix Ben Craven
- An Apology From Ben Ben Craven
- The Best Free Software for Ubuntu Ben Craven
- Catgroove By Parov Stelar Ben Craven
- Mysql Database with PHP and HTML with Search Function Part 3 Ben Craven

An article by










