Re: PHP Question on MySQL grouping

From: Date: Fri, 01 Mar 2002 16:17:49 +0000
Subject: Re: PHP Question on MySQL grouping
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-17391@lists.php.net to get a copy of this message
depending on how you print the result set to the browser, you just need to add an echo "<hr>" at the end of each line. So, if you've fed your result set into an array called $row, then something like: print "$row[0] . $row[1] . $row[2] . "<hr>"; That should print out each result followed by a horizontal rule. Something like that anyway. Hope that helps. "Keiran Wynyard" <keiran@wynyard.net> wrote in message news:NDBBLOOGGIOINDOCECKMEEBIDMAA.keiran@wynyard.net... > I need to loop through a grouped recordset adding a <hr> at the > end of each group, how can groups in recordsets be identified in > PHP for specific formatting. > > SELECT name AS name, dishtype AS dishtype, price AS price > FROM dishes > WHERE used = 1 > GROUP BY dishtype, name > ORDER BY dishtype, price DESC > > The use is in the display of a menu for a restaurant, where there > is a table containing all the dishes on the menu in any given > instance, but they musst be displayed in a specific order, > grouped by type. In other words, all Starters come first, > followed by Main courses, followed by Desserts. Between each type > there needs to be a seperator, the horizontal line. > > Thanks for you help > > Keiran

« previous php.db (#17391) next »