I have some products from a database for a shopping cart....
Right now I have a while loop that grabs all of the fields into variables from a MySQL table.
Is there a way, that when the loop is going through the results, I can have a code that finds the first unique name for each product, then displays it?
For example, instead of just
product
product
product
It would be like:
HATS
product
product
SHIRTS
product
product
So database wise, it would "group" all HATS and SHIRTS together?
I know there are better ways of dojng this, but please indugle me.
Pseudo-code wise would be:
if(fieldname="hats")
(and this is the first "fieldname" field called HATS)
then(echo"<h1>HATS</h1>")
else{
just show the product}
does that make sense?