----- Original Message -----
From: "John W. Holmes"

| John W. Holmes wrote:
|
| You only need one query. One of your columns should be what you want to
| "change" on, like DAYOFWEEK(date_column). As you loop through your rows,
| you echo out your "heading" whenever this column changes...
|
| while($row = mysql_fetch_assoc($result))
| {
|    if($row['dayofweek_column'] != $old_dayofweek)
|    {
|      echo "<tr><th>{$row['dayofweek_column']}'s Columns</th></tr>";
|      $old_dayofweek = $row['dayofweek_column'];
|    }
|    echo "$row[title] <br/> Written by $row[author] <br/> $row[text]";
| }
|
| Untested, but something like that. :)

--

John W. Holmes, Thank you greatly!
With some modifications I got it to work, thanks for pointing me in the
right direction!
.. and yes you were right about the fetch_row, it was a typo.

$result = $db->sql("SELECT * FROM $news GROUP BY time DESC LIMIT
$_GET[page], $pagelimit");
 while($row = mysql_fetch_array($result)) {

$content[timedate] = date("l",$row['time']);

   $newsfor = "";
   if($content[timedate] != $old_dayofweek)
   {
     $newsfor = "<span class=\"newsdate\">News for
$content['datefor']</span> <br/>";
     $old_dayofweek = $content[timedate];
   }

echo "$newsfor $row[title] <br/> Written by $row[author] <br/> $row[text]";

}


cheers,
- Sebastian





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

Reply via email to