We help IT Professionals succeed at work.

MySQL syntax problem, can anyone correct?

stormist
stormist asked
on
Medium Priority
262 Views
Last Modified: 2006-11-18
$sql2 = "SELECT numberforsession FROM sessions WHERE userone = '$sessions_waiting[1]' AND where usertwo = '$usernumber' LIMIT 1";

result:
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 'where usertwo = '1' LIMIT 1' at line 1
Comment
Watch Question

CERTIFIED EXPERT
Top Expert 2004
Commented:
Hi stormist,

Should be:

$sql2 = "SELECT numberforsession FROM sessions WHERE userone = '$sessions_waiting[1]' AND usertwo = '$usernumber' LIMIT 1";


Regards,
Ted

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
CERTIFIED EXPERT
Top Expert 2004

Commented:
Zyloch,

Although if usertwo and user1 are a number type, you also don't need the single quotes surrouding them.

Ted

Author

Commented:
Thanks Ted!
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.