Wednesday, 15 February 2012

php - Syntax error on return statement -


I am making this simple website, and I have been participating in this error:

My Function:

  & lt ;? Php function user_exists ($ username) {$ username = sanitize ($ username); $ Query = mysqli_query ($ connect, "SELECT COUNT (` user_id`) WHERE` username '=' $ user name 'from `users`); Return (mysqli_result ($ query, === 0) 1) Correct wrong ;}? & Gt;   

My PHP error log:

  PHP parse error: syntax error, unexpected '===' (T_IS_IDENTICAL)  

I understand what is a syntax error, but I'm pretty sure that '===' is not a problem .

< P> Edit: I was only talking about state of the state and this answer is false because the mysqli_result () function is not present.

I think you Trying to do this:

  return mysqli_result ($ query) ===? True false;   

And as Marcel Corpel said Use the prepared statement to avoid security flaws.

No comments:

Post a Comment