Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Problem login in


Darklings

Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

 

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

Link to comment
Share on other sites

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) . "'");

Link to comment
Share on other sites

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) . "'");

 

 

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

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...