kts Posted December 28, 2007 Share Posted December 28, 2007 I'm trying to get the where clause to respond only where the categories_id is similiar to the $cPath variable I'm sending. It works without the where clause, and I have it all included, so im not sure why it won't allow for this where clause. <?php $cquery = "SELECT products.products_id, products.products_price, products.products_quantity, products.products_image, products.products_status, products_description.products_name, products_description.products_description, products_description.language_id, products.manufacturers_id, products_to_categories.categories_id, categories_description.categories_name FROM products JOIN products_description ON (products.products_id = products_description.products_id) JOIN products_to_categories ON (products_description.products_id = products_to_categories.products_id) JOIN categories_description ON (products_to_categories.categories_id = categories_description.categories_id) where products_to_categories.categories_id = $cPath"; ?> Link to comment https://forums.phpfreaks.com/topic/83469-solved-syntax-error-on-a-multiple-left-join-with-a-where-clause/ Share on other sites More sharing options...
revraz Posted December 28, 2007 Share Posted December 28, 2007 See if this works where products_to_categories.categories_id = '$cPath'"; Link to comment https://forums.phpfreaks.com/topic/83469-solved-syntax-error-on-a-multiple-left-join-with-a-where-clause/#findComment-424656 Share on other sites More sharing options...
kts Posted December 28, 2007 Author Share Posted December 28, 2007 heh thanks, was driving me nuts.... yeah sometimes its the simple things in life Link to comment https://forums.phpfreaks.com/topic/83469-solved-syntax-error-on-a-multiple-left-join-with-a-where-clause/#findComment-424661 Share on other sites More sharing options...
revraz Posted December 28, 2007 Share Posted December 28, 2007 You should really use an alias too for those table names, would save you a ton of typing Link to comment https://forums.phpfreaks.com/topic/83469-solved-syntax-error-on-a-multiple-left-join-with-a-where-clause/#findComment-424664 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.