Jump to content

Help with select syntax


acer88

Recommended Posts

I get this error when trying to do a mysql query with select.

Here is the error I get:

SELECT 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 'select barcode from itemdescription) order by listing.date DESC

and here is the code that I believe is generating the error:

//$records = mysql_query( "SELECT *  FROM listing where title like '%$title%' and barcode in (select barcode from itemdescription) order by date DESC")
$records = mysql_query( "SELECT listing.recordid,listing.barcode,listing.itemnumber,listing.title,listing.inputdate,itemdescription.category,
category.categoryname FROM listing left join itemdescription on listing.barcode=itemdescription.barcode left join
category on itemdescription.category=category.categoryid where listing.title like '%$title%'
  and listing.barcode in (select barcode from itemdescription) order by listing.date DESC")
or die("SELECT Error: ".mysql_error());
$num_rows = mysql_num_rows($records);



what is wrong with my syntax?? Sometimes it just take another pair of eyes to spot the problem:) Thanks

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.