I am having trouble with my register form, it doesn’t seam to be inputting the data into my database.
Here is the HTML page:
[code]
WoW Luck - Create AccountWelcome to WoWLuck.com!
WoW just got better.
Latest Jackpot Winners
10,000G Winner
Bigwork of The Forgotten Coast
Contact
| Username * | |
| Password * | |
| Confirm Password * | |
| Character Name | |
| Realm Name | |
| E-mail * | |
* = Required
Here is the php page:
[php]<?
/* This code will make a connection with database */
$con=mysql_connect(“localhost”,“root”,“password”);
/* Now, we select the database */
mysql_select_db(“mmoluck”);
/* Now we will store the values submitted by form in variable */
$username=$_POST[‘username’];
$pass=$_POST[‘password’];
$char=$_POST[‘character’];
$realm=$_POST[‘realm’];
$email=$_POST[‘email’];
/* we are now encrypting password while using md5() function */
$password=md5($pass);
$confirm_password=$_POST[‘confirm_password’];
$confirm_email=$_POST[‘confirm_email’]:
/* Now we will check if username is already in use or not */
$queryuser=mysql_query("SELECT * FROM accounts WHERE username=’$username’ ");
$checkuser=mysql_num_rows($queryuser);
if($checkuser != 0)
{ echo “Sorry, “.$username.” is already been taken.”; }
else {
$queryuser=mysql_query("SELECT * FROM email WHERE email=’$email’ ");
$checkuser=mysql_num_rows($queryuser);
if($checkuser != 0)
{ echo “Sorry, “.$email.” is already being used.”; }
else {
/* now we will check if password and confirm password matched */
if($pass != $confirm_password)
{ echo “Password and confirm password fields were not matched”; }
else {
if($email != $confrim_email)
{ echo “E-mail and confirm e-mail fields were not matched”; }
else {
/* Now we will write a query to insert user details into database */
$insert_user=mysql_query(“INSERT INTO accounts (username, password, character, realm, email) VALUES (’$username’, ‘$password’ ‘$character’, ‘$realm’, ‘$email’)”);
if($insert_user)
{ echo “Registration Succesfull”; }
else
{ echo “error in registration”.mysql_error(); }
/* closing the if else statements */
}}
mysql_close($con);
?>[/php]