I'm having the same issues, and there is nothing wrong with my query. I've check 3wschools.com and a PHP book and they both show that this query format is valid and should work. So why does it give that error, it's frustrating to no end and I've tried all you solutions and none work.
here is the output of scyfox code that I added to my one script:
"Issues trying to fetch results. Check the error-->You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'group = 4' at line 1"
But the query isn't even on line one, line one has the <html> tag. So it only helps a little but doesn't give a real working answer to the problem at hand. So why is this happening? We need a real answer with a real solution.
This is the query I'm using:
"SELECT * FROM user WHERE group = " . $grp;
The idea I have is to have the user use a third option when loging in. If he or she is and is an admin then their corresponding group number would be 4 if they're a user then their group number would be 1. So if they want to login they have to selece the wright group. The login script would then selecet all the in formation from the user table where the group number would corrispond with the one selected by the user loging in and check if the user name and password is pressent in the DB under that group.