Ok so im creating a sign up page in PHP using MySQL and this is the error I get when i try and run it:
I’ve searched and searched and have failed to yield any answers on what GIVES that error so that I can try and fix it… any ideas?
here’s the code I’m working on. (Line 57 is commented)
<?php
include 'db.php';
$submitted = $_POST["submitted"];
$errors = false;
if ($submitted == 'true'){
$username = $_POST["user_name"];
$firstname = $_POST["first_name"];
$lastname = $_POST["last_name"];
$email = $_POST["e_mail"];
$password = $_POST["password"];
$conf = $_POST["password_conf"];
$firstname = stripslashes($firstname);
$lastname = stripslashes($lastname);
$email = stripslashes($email);
$username = stripslashes($username);
$password = stripslashes($password);
$conf = stripslashes($conf);
if(!$username || !$firstname || !$lastname || !$email || !$password || !$conf){
if(!$username){
echo 'You did not choose a user name, it is required <br/>';
$errors = true;
}
if(!$firstname){
echo 'You did not enter your first name, it is required <br/>';
$errors = true;
}
if(!$lastname){
echo 'You did not enter your last name, it is required <br/>';
$errors = true;
}
if(!$email){
echo 'You did not enter your E-Mail address, it is required <br/>';
$errors = true;
}
if($password == $conf){
if(!$password){
echo 'You did not pick a password, please pick one <br/>';
$errors = true;
}
if(!$conf){
echo 'You did not validate your password, please enter it twice <br/>';
$errors = true;
}
} else {
echo "Your passwords don't match, try again <br/>";
$errors = true;
}
}
if($errors == true){
include "signup.htm";
} else {
$sql_username_check = mysql_query("SELECT user_name FROM users WHERE user_name='$username'");
**//----LINE 57--------------------------------------------**
$username_check = mysql_num_rows($sql_username_check);
if($username_check > 0){
echo "The username you have chosen is already in use by someone else, please try a different one";
unset($username);
include 'signup.htm';
}
}
} else {
include 'signup.htm';
}