Darklings Posted August 22, 2005 Posted August 22, 2005 Hi all, When i put something in the shopping_cart as a guest and then want to log in - i get the folowing error: 1052 - Column: 'products_id' in where clause is ambiguous select pc.products_id, categories_id, customers_basket_quantity from customers_basket LEFT JOIN products_to_categories pc using(products_id) where customers_id = '2' and products_id = '92' [TEP STOP] I think this is caused by my classes/shopping_cart.php and the error is about this i think: $product_query = tep_db_query("select pc.products_id, categories_id, customers_basket_quantity from " . TABLE_CUSTOMERS_BASKET . " LEFT JOIN " . TABLE_PRODUCTS_TO_CATEGORIES . " pc using(products_id) where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products_id) . "'"); Am i doing something wrong here? I searched the internet, and it tells me the error is caused by the products_id that is prob in more then one place and my code doesnt know where to get it from... so i put the 'pc' upfront and then said for what it stood... I'm using sppc and am modding the code - so it most likely wont look as anything as you got - but i guess something familier with the tep_db_query an help me out here? Would be nice Thnx, Kind Regards, Tom Even in this dark place, yes, I am afraid of my own shadow. Contributions | KnowledgeBase | osCommerce 2.2 pdf
Guest Posted August 22, 2005 Posted August 22, 2005 have you tried using the refs in front of the fields? for instance instead of products_id use pc.products_id for your dbase tables.
Darklings Posted August 22, 2005 Author Posted August 22, 2005 have you tried using the refs in front of the fields? for instance instead of products_id use pc.products_id for your dbase tables. <{POST_SNAPBACK}> Oh, i forgot to mention i'm a php-starter - what do you mean?? refs? fields? you mean my insterts or something? or somewhere on another page?? Kind Regards :D Tom Even in this dark place, yes, I am afraid of my own shadow. Contributions | KnowledgeBase | osCommerce 2.2 pdf
Guest Posted August 22, 2005 Posted August 22, 2005 No I meant Instead of this $product_query = tep_db_query("select pc.products_id, categories_id, customers_basket_quantity from " . TABLE_CUSTOMERS_BASKET . " LEFT JOIN " . TABLE_PRODUCTS_TO_CATEGORIES . " pc using(products_id) where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products_id) . "'"); use this: $product_query = tep_db_query("select pc.products_id, categories_id, customers_basket_quantity from " . TABLE_CUSTOMERS_BASKET . " LEFT JOIN " . TABLE_PRODUCTS_TO_CATEGORIES . " pc using(products_id) where customers_id = '" . (int)$customer_id . "' and pc.products_id = '" . tep_db_input($products_id) . "'");
Darklings Posted August 23, 2005 Author Posted August 23, 2005 No I meant Instead of this $product_query = tep_db_query("select pc.products_id, categories_id, customers_basket_quantity ?from " . TABLE_CUSTOMERS_BASKET . " LEFT JOIN " . TABLE_PRODUCTS_TO_CATEGORIES . " pc using(products_id) where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products_id) . "'"); use this: $product_query = tep_db_query("select pc.products_id, categories_id, customers_basket_quantity ?from " . TABLE_CUSTOMERS_BASKET . " LEFT JOIN " . TABLE_PRODUCTS_TO_CATEGORIES . " pc using(products_id) where customers_id = '" . (int)$customer_id . "' and pc.products_id = '" . tep_db_input($products_id) . "'"); <{POST_SNAPBACK}> Indeed - thank you verry much - that solved my problem :D Kind Regards Even in this dark place, yes, I am afraid of my own shadow. Contributions | KnowledgeBase | osCommerce 2.2 pdf
Recommended Posts
Archived
This topic is now archived and is closed to further replies.