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

[eluser]obiron2[/eluser]
If I have this right, you want to list all of the products with a checkbox ,but only tick the box if the shop sells that product.

rewite your db query.

select p.productID,count(s.productid) from products p left join shopproducts s on p.productid = s.productid
where s.shopid = $shopid
order by productid


What you will get is a list of all products (left join) and a 1 if the shop sells that or 0 if it does not.

You can then use the 1 and 0 to decide whether to activate the checkbox.

Obiron


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