Error in "=" in mysqli_query

Asked

Viewed 110 times

1

I have a problem in mysqli_query and I can’t find the error. I tried to make some changes I saw on the Internet and it didn’t do any good. I also tried to change the line that is file problem, but the error persisted. The error message is:

[Thu Aug 17 11:57:43.192874 2017] [:error] [pid 2716] [client ::1:39160] PHP Parse error: syntax error, Unexpected '=' in /var/www/html/valida_login.php on line 7, referer: http://localhost/login.php

And the quoted line is:

result = mysqli_query("SELECT * FROM usuario WHERE login = '$usuario' AND senha = '$senha';");
  • 6

    Missed the $ in the variable name? result?

  • 1

    That’s right, thank you!

  • @rray posted as wiki to close the issue, but if you prefer we can remove and you answer "officially" to receive the appropriate upvotes.

1 answer

4


As resolved by @rray us comments, is syntax error.

Foul $ in assignment (so that PHP knows that it is a variable):

$result = mysqli_query("SELECT ...
^

Browser other questions tagged

You are not signed in. Login or sign up in order to post.