what is wrong with this statement?

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
wvoyance
Forum Contributor
Posts: 135
Joined: Tue Apr 17, 2012 8:24 pm

what is wrong with this statement?

Post 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?
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: what is wrong with this statement?

Post 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.
User avatar
wvoyance
Forum Contributor
Posts: 135
Joined: Tue Apr 17, 2012 8:24 pm

Re: what is wrong with this statement?

Post 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>
Post Reply