mysqli - Syntax error but I don't see it? (PHP/MySQLi_Query) -
so have been working on different php scripts day, don't know if it's eyes , need break or what: wrote line connect mysql database, , check if username exists. error messages of course less helpful (even when searched don't seem apply working on or don't show anything.
error 1 (before put in or die(mysqli_error($mycon)):
warning: mysqli_num_rows() expects parameter 1 mysqli_result, boolean given in /home/icangame/public_html/dev/php/userregister.php on line 40
error 2 (after put in or die statement):
you have error in sql syntax; check manual corresponds mysql server version right syntax use near '== `user`' @ line 1
code apples (will post more if want, it's big file.):
$checktherow = mysqli_query($mycon, "select * users `username` == `$realusername`") or die(mysqli_error($mycon)); if (mysqli_num_rows($checktherow) == 0) { mysqli_query($mycon, "insert users (username, password, email) values ('$realusername', '$realpassword', '$email')") or die(mysqli_error($mycon)); }
thanks, tim
i think need break
replace
$checktherow = mysqli_query($mycon, "select * users `username` == `$realusername`") or die(mysqli_error($mycon));
with
$checktherow = mysqli_query($mycon, "select * users `username` = `{$realusername}`") or die(mysqli_error($mycon));
note ==
in query
it mysql syntax error $checktherow
returning false
Comments
Post a Comment