I am creating my users two files when they register. at the bottom of my code you will see. when I changed this code I get this error now.
error in registrationYou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
I dont see why this when give me an error at line one where my connect file is but maybe someone can help me out with this..
<?php
include ('connect.php');
/* Now we will store the values submitted by form in variable */
$first=$_POST['first'];
$last=$_POST['last'];
$phone=$_POST['phone'];
$mobile=$_POST['mobile'];
$username=$_POST['username'];
$email=$_POST['email'];
$web=$_POST['web'];
$password=$_POST['password'];
$password1=$_POST['password1'];
/* Now we will check if username is already in use or not */
$queryusername=mysql_query("SELECT * FROM users WHERE username='$username' ");
$checkusername=mysql_num_rows($queryusername);
if($checkusername != 0)
{ echo "Sorry, ".$username." is already been taken."; }
else {
/* now we will check if password and confirm password matched */
if($password != $password1)
{ echo "Password and confirm password fields were not matched"; }
else {
//making a dir for default avatar image */
$default_image = "members/default/default_avatar.jpg";
//making a dir for the users gallery images to be stored */
$gallery = "gallery";
$directory = "members/$username/$gallery";
/*file mode set for global access */
$mode = "0777";
/* Now we will write a query to insert user details into database */
$insert_users=mysql_query("INSERT INTO users (first, last, phone, mobile, username, email, web, password, profileimage, gallery) VALUES ('$first', '$last', '$phone', '$mobile', '$username', '$email', '$web', '$password', '$default_image', '$directory'");
if($insert_users)
{ //creates a dir for the user
mkdir($directory, $mode, true);
echo "Registration Successful Please Login.<a href='access.php'>Redirecting to login page</a>";
header( "refresh:1;url=access.php" );
}
else
{ echo "error in registration".mysql_error();
header( "refresh:4;url=access.php" );
}
/* closing the if else statements */
}}
mysql_close();
?>

