On Mon, May 22, 2006 6:53 am, Jonas Rosling wrote:
> Anyone know any good why to group date in a recordset in any good way?
> As if
> you categorize it in columns. Like:
>
> Category 1
>       Row1 -> Data    Data
>       Row2 -> Data    Data
>       Row3 -> Data    Data
>
> Category 2
>       Row1 -> Data    Date
>       Row2 -> Data    Data
>       Row3 -> Data    Data

$query =
'SELECT category, row, data FROM whatever ORDER BY category, row, data';
$info = @mysql_query($query, $connection) or
trigger_error(mysql_error(), E_USER_NOTICE);

$last_category = '';
while (list($category, $row, $data) = mysql_fetch_row($info)){
  if ($last_category != $category){
    echo "$category<br />\n";
    $last_category = $category;
  }
  echo "$row -> $data<br />\n";
}

-- 
Like Music?
http://l-i-e.com/artists.htm

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

Reply via email to