Setting up the database
To setup the database you need to have phpmyadmin. If you are using a local webserver it is probably located at http://localhost/phpmyadmin or if you have a web host check your cpanel. Open up php my admin and you should see a box that says "create a new database". type "mysite" as the name of it and press enter. If you want to use a different name you can. For now just make a table called "users" and put number of fields at 3, this table will obviously store the users data. Now in the field boxes put in "id", "username", "userpass" without quotes. Mysql is case sensitive so don't capitalize anything. Under Type keep int for the id and change username and userpass to varchar. This means id is a number and the other two can be numbers or characters mixed. We are almost done! set the id to auto increment or A_I towards the bottom and give id a length of 10. Set username and userpass to a length of 40. before clicking go view this picture to see if you have it right:
The last thing to do for part 1 is make the register page. All this page will do is submit the data to another page, maybe called registerme.php and that will insert it into the database.
- Code: Select all
<form action="registerme.php" method="post">
<li class="textbox">Please register for my site!</li>
<li class="bigfield"><input name="user" placeholder="Username" type="text" /></li>
<input name ="pass" placeholder="Password" type="password" /></li>
<input name ="pass2" placeholder="Re-enter Pass" type="password" /></li>
All i did here was use some form elements from iwebkit. I will soon make the next tutorial. If you need any more help ask here.