Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

MySQL Select problem


higgalls

Recommended Posts

Hey,

 

I am using one of the XML exporter contribs to create an XML list of my categories and products, and I am modifying it a bit.

 

I am having a problem with the following SQL:

 

$product_query = "SELECT `products`.`products_id`,`products`.`products_quantity`,`products`.`products_model`,`products`.`products_image`,`products`.`products_price`,`products`.`products_date_added`,`products`.`products_last_modified`,`products`.`products_date_available`,`products`.`products_weight`,`products`.`products_status`,`products`.`manufacturers_id`,`products_description`.`products_name`,`products_description`.`products_url`, `manufacturers`.`manufacturers_name`, 'products_to_categories'.'categories_id' FROM `products` INNER JOIN `products_description` ON (`products`.`products_id` = `products_description`.`products_id`) INNER JOIN `products_to_categories` ON (`products`.`products_id` = `products_to_categories`.`products_id`) INNER JOIN `manufacturers` ON (`products`.`manufacturers_id` = `manufacturers`.`manufacturers_id`)";

 

Basically, everything was working until I changed the SELECT query and put in the products_to_categories stuff.

I want to then go and add a WHERE clause to only select products in a certain category (eg, WHERE 'products_to_categories'.'categories_id' = 5).

 

Any help would be greatly appreciated, as this is the last thing I need to do before this XML part is working for what I need to do.

 

Cheers,

Chris :)

Link to comment
Share on other sites

I am having a problem with the following SQL:

I don't know why all these backticks are used, but you seem to have changed those to regular quote signs here... and that will not fly. Just leave them away I would say.

'products_to_categories'.'categories_id'

Link to comment
Share on other sites

I don't know why all these backticks are used, but you seem to have changed those to regular quote signs here... and that will not fly. Just leave them away I would say.

'products_to_categories'.'categories_id'

 

Hi,

 

You are a champ. I hadn't realised there was a difference between the back ticks and the single quotes. I just thought it was a font problem originally.

 

It is now working. Thanks heaps for that.

 

Cheers,

Chris :)

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...