CodeIgniter Forums
populating a checkbox from database - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: populating a checkbox from database (/showthread.php?tid=14687)

Pages: 1 2


populating a checkbox from database - El Forum - 01-16-2009

[eluser]obiron2[/eluser]
It looks like it should work.



Try changing the following:

The productsbyshop records should have a unique reference id.

change 'count(productsbyshop.product_id)' to count '(productbyshop.uniqueid)'

if it still doesn't work, try removing the count and group and just listing the product.product_id and productbyshop.unique_id.

You should get all product.product_id and NULL where the productbyshop record does not exist.

Obiron


populating a checkbox from database - El Forum - 01-16-2009

[eluser]sore eyes[/eluser]
Hi Obiron, many thanks for your help. I do appreciate it. I have tried making the changes that you suggest, but to no avail. I introduced the unique id and taken out the group and count, but it does not list all the product.product_id. By the way, the counting is working successfully, but only limited to '1'.

I suspect the answer lies in the WHERE clause. This clause may be limiting the resultant set to only those values that have a product_id in the productsbyshop table. If this is the case, I don't know how to work around it. What do you think?