I’ve seen many questions like this on stack overflow, but I want to know why my code won’t work. It makes perfect (logical) sense. Can anyone please explain to me what code I would have to write to actually complete the if statement I have in mind?
$result = mysql_query("SELECT confirmed FROM usernames WHERE username = '$username' AND password = '$password'")
if ($result==NULL)
echo 'Failure';
I’m attempting this in php.
NOTE:
confirmed in the DB is set to NULL, so the final echo should display.
The variable
$resultcontains an internal representation of the result of the query (as returned by themysql_query()function). To get the actual value you need to use another function, likemysql_fetch_assoc()ormysql_result(). Kind of like this: