Syntax error, (T_STRING)

$results = mysqli_query(SELECT * FROM logins WHERE username=’$username’ AND password=’$password’);
I cant seem to fix the syntax error, unexpected ‘logins’ (T_STRING) error.
Anyone else had this problem?

Well, you can’t write a query that way!
First, you can either save the query inside a variable like this:
$query = “SELECT * FROM…”; Then,
mysqli_query($conn, $query) Where the $conn is your connection string…

OR

$results = mysqli_query($conn, "SELECT * FROM logins WHERE username… ");

You need to include your connection string and also place your query inside of quotes.
Hope that helps…

Sponsor our Newsletter | Privacy Policy | Terms of Service