user6543208 user6543208 - 1 year ago 61
MySQL Question

Data is not inserting on the database Game resgistration

So im making a web game app my problem is my

is not inserting users in the database please need help by the way im just a beginner in PHP Thanks

Here is the Code:

$Username = mysql_real_escape_string($_POST['Username']);
$Password = md5(mysql_real_escape_string($_POST['Password']));
$Email = mysql_real_escape_string($_POST['Email']);

$query_check ="SELECT user_name FROM account_info WHERE user_name = '$Username'";
$retval_check = mysql_query( $query_check, $conn );

if( $Username == "" || $Password == "" || $Email == "" ){
echo"Please fill the field";
} else{
echo"Username Already Taken";
} else {
$query = "INSERT INTO account_info(user_name,user_passemail) VALUES ('$Username','$Password','$Email');";
$retval = mysql_query( $query, $conn );

echo "<script>";
echo "alert('Thank you for registering Enjoy the game !')";
echo "</script>";

echo "<script>";
echo 'location.href = "menu.html";';
echo "</script>";



Answer Source


$query = "INSERT INTO account_info(user_name,user_passemail) VALUES ('$Username','$Password','$Email');";


$query = "INSERT INTO account_info(user_name,user_pass,email) VALUES ('$Username','$Password','$Email');";

You forgot to add a comma ","

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download