|
Posted by Andrew Kreps on 10/04/22 11:05
On Mon, 10 Jan 2005 16:38:18 -0500, Sebastian
<sebastian@broadbandgaming.net> wrote:
> I have a list of rows in the database and i would like to sort them in two
> categories.
> example,
>
> echo $row['name'] . '-' . $row['type'];
>
> // output:
>
> row 1 - files
>
add order by `type` to your sql statement, and then put something like
the following in your mysql loop:
// initialize $prevType above
if ($prevType !== $row['type'])
{
print "<hr>" . $row['type'] . "------<br>"; // Or whatever you
want the header to look like
}
$prevType = $row['type'];
That should do the trick.
Navigation:
[Reply to this message]
|