Welcome Guest, Not a member yet? Register   Sign In
populating a checkbox from database
#8

[eluser]sore eyes[/eluser]
Many thanks for this Obiron, it was just what I wanted. I'm still struggling a bit, as this is my first join. I have made some modifications. The query now reads

Code:
$query = $this->db->query("SELECT products.product_id,count(productsbyshop.product_id)
AS counting FROM products LEFT JOIN productsbyshop ON
products.product_id = productsbyshop.product_id
WHERE productsbyshop.shop_id = '$shop_id'
GROUP BY products.product_id ORDER by products.product_id");

The problem is that it does not list all the products, only those that are selected. I thought that having the table 'products' on the left of the 'left join' would make it show all of the products, but it does not. I did not understand what the single 'p' and 's' were in the query, so I removed them and this may be the source of the error.

Can you help please?


Messages In This Thread
populating a checkbox from database - by El Forum - 01-11-2009, 08:27 PM
populating a checkbox from database - by El Forum - 01-11-2009, 09:11 PM
populating a checkbox from database - by El Forum - 01-11-2009, 09:17 PM
populating a checkbox from database - by El Forum - 01-11-2009, 09:31 PM
populating a checkbox from database - by El Forum - 01-11-2009, 09:43 PM
populating a checkbox from database - by El Forum - 01-12-2009, 07:27 AM
populating a checkbox from database - by El Forum - 01-12-2009, 08:22 AM
populating a checkbox from database - by El Forum - 01-15-2009, 08:40 PM
populating a checkbox from database - by El Forum - 01-15-2009, 09:53 PM
populating a checkbox from database - by El Forum - 01-16-2009, 01:23 AM
populating a checkbox from database - by El Forum - 01-16-2009, 06:01 AM
populating a checkbox from database - by El Forum - 01-16-2009, 08:54 PM



Theme © iAndrew 2016 - Forum software by © MyBB