Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8965743
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T16:52:34+00:00 2026-06-15T16:52:34+00:00

I have an MySQL error and I cannot figure it out… It was working

  • 0

I have an MySQL error and I cannot figure it out… It was working and now it is not working anymore (I haven’t done anything to the database).

Here is the query:

$querySearch = "SELECT * FROM cars WHERE (price >= {$startPrice} AND price <= $endPrice) AND condition = '{$condition}'";

Here is the form:

<h3>Condition:</h3>
<span class="searchRange">
<select name="condition" class="condition">
    <option value="any">Any Condition</option>
    <option value="Brand New">Brand New</option>
    <option value="Near New">Near New</option>
    <option value="Good">Good</option>
    <option value="Ok">Ok</option>
    <option value="Poor">Poor</option>
</select>
</span>

And here is how PHP receives the data:

$condition = mysql_prep($_POST['condition']);

mysql_prep() is a user made function that just takes care of the magic quote stuff.

Anyone see where an error could occur?

Error: Database query failed: 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 ‘condition = ‘Near New” at line 1

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T16:52:35+00:00Added an answer on June 15, 2026 at 4:52 pm

    Condition is a reserved keyword

    Enclose it in backticks.

    AND `condition` =
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple error that I just cannot figure out why I am
I have a logic error I cannot for the life of me figure out.
I have run into this problem multiple times, and I cannot figure out why
I have mysql error with code 1451. Cannot delete or update a parent row:
I have been staring at this code for hours now and I cannot figure
I have the following Codeigniter (MySQL related) error in my application Error Number: 1100
I have a mysql stored procedure which is giving me the following error:- #1064
I am getting an Error in MySQL: You have an error in your SQL
I have the following error message: SQLSTATE[HY000] [2003] Can't connect to MySQL server on
Error is: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.