Why is this query failing?

Posted on 16th Feb 2014 by admin

Why is this not working?
$query = "SELECT * FROM `users` WHERE `userid` = " . $USERID AND `pin` = " . $PIN;
$result = mysql_query($query)
or die("Web site query failed");

When I all I have is:
$query = "SELECT * FROM `users` WHERE `userid` = " . $USERID;
$result = mysql_query($query)
or die("Web site query failed");

It does work. But when I ad the PIN, it just fails. I have the variable $PIN assigned and I have a field called pin.

Thanks

Other forums