I am trying to make a registration script and when I run the code below, I get this error message:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'group ) VALUES ( 'theusernameiposted' , '6032e6baa29d1f72eef838fabd7987cbfa3a11f7549d' at line 1
I presume it is just an extra comma or something but I can't spot it!
Any help is greatly appreciated!
// my connect and choose database script goes here
$username = $_POST['myusername'];
$password = $_POST['mypassword'];
$group = $_POST['group'];
if(strlen($username) > 30)
$hash = hash('sha256', $password);
$string = md5(uniqid(rand(), true));
return substr($string, 0, 3);
$salt = createSalt();
$hash = hash('sha256', $salt . $hash);
$username = mysql_real_escape_string($username);
$query = "INSERT INTO users ( username, password, salt, group )
VALUES ( '$username' , '$hash' , '$salt' , '$group' )";
echo "The new user has been created. Thank you.";
Last edited by jake66; 01-04-2012 at 09:25 PM..