So in my account creation script, I have $sStrippedUser = preg_replace('#[^a-z0-9]+#i', '', $username) or die("Problem stripping name"); if ( $username != $sStrippedUser ){ $username = $sStrippedUser; echo 'Your username can only include letters and numbers. Please choose a different one.'; exit; } $mquery = mysql_query("SELECT username FROM users") or die(mysql_error()); while($row = mysql_fetch_array($mquery)){ $takenname = $row['username']; $takenname = strtolower($takenname); if($takenname == $sStripperUser) { // $rQuery = mysql_query('SELECT `id` FROM `users` WHERE LOWER(`username`) = "' . strtolower($username) . '"') or die(mysql_error()); // $iRows = mysql_num_rows($rQuery) or die(mysql_error()); // $iRows = mysql_num_rows($rQuery) or die(mysql_error()); // if ( $iRows == 1 ) { $regerror = "yes"; } } if($regerror == "yes") { echo "Sorry, but that username is already in use."; exit; } PHP: And I keep getting this very annoying error. It says: 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 'boards, all very easily. Thank you for registering, and just to let you know, t' at line 1 Please help me with finding out what is causing the error. If you need anymore info, just tell me. EDIT!! I fixed it. I had a " ' " in a variable that I had in another one so it looked sorta like echo ' lol' haha';
Hi, Please check this code i think it is fixed <? $sStrippedUser = preg_replace('#[^a-z0-9]+#i', '', $username) or die("Problem stripping name"); if ( $username != $sStrippedUser ){ $username = $sStrippedUser; echo 'Your username can only include letters and numbers. Please choose a different one.'; exit; } $mquery = mysql_query("SELECT username FROM users") or die(mysql_error()); while($row = mysql_fetch_array($mquery), MYSQL_BOTH){ $takenname = $row['username']; $takenname = strtolower($takenname); if($takenname == $sStripperUser) { // $rQuery = mysql_query('SELECT `id` FROM `users` WHERE LOWER(`username`) = "' . strtolower($username) . '"') or die(mysql_error()); // $iRows = mysql_num_rows($rQuery) or die(mysql_error()); // $iRows = mysql_num_rows($rQuery) or die(mysql_error()); // if ( $iRows == 1 ) { $regerror = "yes"; } } if($regerror == "yes") { echo "Sorry, but that username is already in use."; exit; } ?> PHP: