Page 1 of 1

what is wrong with this statement?

Posted: Mon Jun 04, 2012 7:53 am
by wvoyance
$result = tep_db_query("SELECT products_image FROM products where products_model =" . $isbn);

I am trying to test whether any record with products_model = ... already exists.
Is there any better way to do the test, instead of accessing a record?

Re: what is wrong with this statement?

Posted: Mon Jun 04, 2012 8:06 am
by Celauran
What is the problem? Is it returning some error? The query looks fine at a glance, though I have no idea what tep_db_query is.

Re: what is wrong with this statement?

Posted: Mon Jun 04, 2012 9:03 am
by wvoyance
Celauran wrote:What is the problem? Is it returning some error? The query looks fine at a glance, though I have no idea what tep_db_query is.
tep_db_query is a function of OSCommerce. I did not remove it, before I post, in case that makes difference.
It simply pass a query string to MySQL

The table has an auto-increase index and a unique field products_model.

The error message appeared in the XHR

<font color="#000000"><strong>1064 - 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 '' at line 1<br /><br />SELECT products_image FROM products where products_model =<br /><br /><small><font color="#ff0000">[TEP STOP]</font></small><br /><br /></strong></font>