Jump to content
Larry Ullman's Book Forums

Sql Syntax Problem With Select


Recommended Posts

Hi all,

Please see the following code:

if (isset($_POST['curtain_add_to_basket'])) { $quote_no = $_POST['basket']; //request the inclusion of the mysql connect file require (MYSQL); $q = "SELECT * FROM saved_curtains WHERE quote_no. = '$quote_no' "; $r = mysqli_query($dbc, $q) or trigger_error("Query: $q\n
MySQL Error: " . mysqli_error($dbc)); if (mysqli_num_rows($r) == 1) { echo'
It worked
'; exit(); } }

 

I get the following error:

 

An error has occurred in script 'C:\xampp\htdocs\Dis Soft Furnishings\web\account.php' on line 40: Query: SELECT * FROM saved_curtains WHERE quote_no. = '11'

MySQL 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 '= '11'' at line 3

Date/Time: 6-15-2012 16:02:21

. print_r(Array, 1) .

 

The quote number should be 11, so it's picking up the correct figure from $_POST. I've tried putting $quote_no in quotes and not in quotes. Same error.

 

Any ideas would be great.

Cheers

Paul

Link to comment
Share on other sites

 Share

×
×
  • Create New...