Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Why is the mySQL select not working?


TELLO

Recommended Posts

Posted

why is this select not working? I will use items from shop on other server as x-sell. so I have there the same connection. all works fine. only the select give me only 0 items back. but there must be lot of items.... select on one table works fine... the same result I get on the shop server with this select as a test. so there must be wrong on the select ...

 

 

mysql_select_db($database_AA_SQL, $AA_SQL);
$query_new_products = "SELECT p.products_id, p.products_image, p.products_tax_class_id, pd.products_name, m.manufacturers_image, if(s.status, s.specials_new_products_price, p.products_price) as products_price from products p left join specials s on p.products_id = s.products_id, products_description pd, manufacturers m where p.products_status = '1' and p.products_id = pd.products_id and m.manufacturers_id = p.manufacturers_id and pd.language_id = '2'";
$new_products = mysql_query($query_new_products, $AA_SQL) or die(mysql_error());
$row_new_products = mysql_fetch_assoc($new_products);
$totalRows_new_products = mysql_num_rows($new_products);

 

there is no result on:

echo  $new_products['products_name']:

 

as test the result here is 0:

echo  $totalRows_new_products;

 

thanks for help...

TELLO

Posted

why is this select not working? I will use items from shop on other server as x-sell. so I have there the same connection. all works fine. only the select give me only 0 items back. but there must be lot of items.... select on one table works fine... the same result I get on the shop server with this select as a test. so there must be wrong on the select ...

 

 

mysql_select_db($database_AA_SQL, $AA_SQL);
$query_new_products = "SELECT p.products_id, p.products_image, p.products_tax_class_id, pd.products_name, m.manufacturers_image, if(s.status, s.specials_new_products_price, p.products_price) as products_price from products p left join specials s on p.products_id = s.products_id, products_description pd, manufacturers m where p.products_status = '1' and p.products_id = pd.products_id and m.manufacturers_id = p.manufacturers_id and pd.language_id = '2'";
$new_products = mysql_query($query_new_products, $AA_SQL) or die(mysql_error());
$row_new_products = mysql_fetch_assoc($new_products);
$totalRows_new_products = mysql_num_rows($new_products);

 

there is no result on:

echo  $new_products['products_name']:

 

as test the result here is 0:

echo  $totalRows_new_products;

 

thanks for help...

TELLO

 

Firstly the code doesn't utilize the correct osCommerce DB wrapper functions, but that isn't why it doesn't work.

 

My guess is that there is no language_id 2. Another problem caused by hardcoding rather than using the functions and variables available.

Archived

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

×
×
  • Create New...