[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

MySQL syntax problem, can anyone correct?

Posted on 2006-04-01
3
Medium Priority
?
237 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
0
Comment
Question by:stormist
  • 2
3 Comments
 
LVL 36

Accepted Solution

by:
Zyloch earned 1000 total points
ID: 16351945
Hi stormist,

Should be:

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


Regards,
Ted
0
 
LVL 36

Expert Comment

by:Zyloch
ID: 16351947
Zyloch,

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

Ted
0
 
LVL 10

Author Comment

by:stormist
ID: 16351974
Thanks Ted!
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
It’s a season to be thankful, and we’re thankful for users like you who engage on site, solve technology problems, and network with others in the industry. What tech are we most thankful for? Keep reading.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Suggested Courses

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question