codequirks
Programmer
Hi folks
Just looking for some advice as to what is the most efficient way to do the following, there are several ways but some expertise on efficiency would be great!? Thanks for advice in advance!
There is a MySQL table which contains 'Products' which is outside of my control. There are queries which return either ALL of the 'products' or 'products of a certain type - i.e Select * where type ='fruit'.
What I need to do is print an inventory of these to the screen but separated into 'types' so the user sees a header saying FRUITS then all the fruits, then VEGETABLES and all the veg etc. So what is the best way to do this, multiple calls to the DB and then just echo out each array or just get the one big array (the inventory isn't that big - about 100 items) and somehow (how?) loop through these?
Thanks and hope you are all having a lazy Saturday!
Just looking for some advice as to what is the most efficient way to do the following, there are several ways but some expertise on efficiency would be great!? Thanks for advice in advance!
There is a MySQL table which contains 'Products' which is outside of my control. There are queries which return either ALL of the 'products' or 'products of a certain type - i.e Select * where type ='fruit'.
What I need to do is print an inventory of these to the screen but separated into 'types' so the user sees a header saying FRUITS then all the fruits, then VEGETABLES and all the veg etc. So what is the best way to do this, multiple calls to the DB and then just echo out each array or just get the one big array (the inventory isn't that big - about 100 items) and somehow (how?) loop through these?
Thanks and hope you are all having a lazy Saturday!