Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

I HATE DB QUERIES!!!


Waza04

Recommended Posts

Hiya All,

Can somebody please tell me what is wrong with these two data quireies...

 

$quickie_query = tep_db_query("select products_id from " . TABLE_PRODUCTS . " where products_upc = '" . $HTTP_POST_VARS['quickie'] . "' or products_model '" . $HTTP_GET_VARS['quickie'] . "'");

 

 

And this one:

$quickie_query = tep_db_query("select products_id from " . TABLE_PRODUCTS . " where products_model LIKE '%" . $HTTP_POST_VARS['quickie'] . "%' or and products_upc LIKE '%" . $HTTP_POST_VARS['quickie'] . "%'");

 

Thanks You Very Much!!

 

Warren

Link to comment
Share on other sites

I don't know anything about MySQL, but I just read a query in my cart, and yours looks like it would go like this:

 

$quickie_query = tep_db_query("select products_id from products where products_upc = '" . $HTTP_POST_VARS['quickie'] . "' or products_model '" . $HTTP_GET_VARS['quickie'] . "'");

 

and

 

$quickie_query = tep_db_query("select products_id from products where products_model LIKE '%" . $HTTP_POST_VARS['quickie'] . "%' or and products_upc LIKE '%" . $HTTP_POST_VARS['quickie'] . "%'");

 

Or maybe your way is valid also. I'm not too familiar with MySQL.

Link to comment
Share on other sites

Thanks fr your reply - but that dont work!!

 

I get:

MYSQL QUERY ERROR REPORT --------------------------------------- 1064 - You have an error in your SQL syntax near '''' at line 1 select products_id from products where products_upc = 'DVD-REDCupc' or products_model ''
Link to comment
Share on other sites

Archived

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

×
×
  • Create New...