On Mon, 10 Jan 2005 16:38:18 -0500, Sebastian
<[EMAIL PROTECTED]> 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.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to