Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

sql help needed


ryanf

Recommended Posts

Posted

Hey, I am trying to fix a custom script that I made and I have this select statement in it:

$search = tep_db_query("select products_id, products_model from " . TABLE_PRODUCTS . " where products_model = " . $pieces[0]);
$thissearch = tep_db_fetch_array($search);

I am getting this error when I run it:

1054 - Unknown column '16A1015A' in 'where clause'

select products_id from products where products_model = 16A1015A

[TEP STOP]

and I can't see why. The model number of 16A1015A doesn't exist but shouldn't that just leave the search blank? Or do I have to guard against that with an if statement or something? Thanks for the Help,

 

Ryan

If I was crafty, this would be a funny signature.

Posted

Hey, I figured out my problem after looking at some other select statements I changed the last part to:

select products_id, products_model from " . TABLE_PRODUCTS . " where products_model = '" . $pieces[0] . "'"

had to add some ' around it.

 

Thanks for looking anyway :D

Ryan

If I was crafty, this would be a funny signature.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...