I have a simple SELECT statement that I'm using in PHP:
$vote=mysql_query("SELECT * FROM `votes` where username = '$big_hand_username' AND
`voter` = '$user_name'");
When using this statement I don't get any rows returned. I should get 1 row returned. I only have one row in the votes table and it contains the username field that matches variable $big_hand_username. $big_hand_username & $user_name both contain data and I've echoed them out to make sure.
However, when I just select all from votes table I get 1 row returned, which you'd expect. I can also select all from another table using the same variable:
$vote=mysql_query("SELECT * FROM `users` where username = '$big_hand_username'");
This returns 1 row, which you'd expect as it contains a row containing the matching the field username.
I just can't understand why I can't get a row returned from votes table using the first select statement. Am I missing something? Could it be something to do with construction of the table? I've also tried running through while loop after the select statement but can't see anything wrong. Any pointers would be helpful.