I'm doing this simple website, and I have run into this error:
My function:
<?php
function user_exists($username)
{
$username = sanitize($username);
$query = mysqli_query($connect, "SELECT COUNT(`user_id`) FROM `users` WHERE `username` = '$username'");
return (mysqli_result($query, === 0) 1) ? true : false;
}
?>
My php error log:
PHP Parse error:
syntax error, unexpected '===' (T_IS_IDENTICAL) in function on line 6
Line 6 is the return line.
I understand what a syntax error means, but I'm quite sure that the '==='
is not the problem.
=== 0
, which isn't correct. – andrewsimysqli_result()
. Not allmysql_XXX
functions have a correspondingmysqli_XXX
function, and this is one that they didn't copy. – Barmar($query, === 0)
. You can't pass=== 0
as a parameter. – Rocket Hazmat