[PHP] Re: Breaking apart by group? From: _lallous (elias_bachaalany <email protected>)
Date: 10/12/01

i think I get you...the idea that i got seems to translate to this:

$result = mysql_query("SELECT * FROM tablename ORDER BY publishday");
$lastpublish = '';
while ($r= mysql_fetch_array($result))
{
  if ($lastpublish != $r['publishday'])
 {
   if ($lastpublish != '')
     echo '</table>'; // close previous table
    echo "<table>";
 }
echo "<tr><td>{$r['name']</td><td>{$r['publishday']</td></tr>"; // etc
etc.....
$lastpublish = $r['publishday'];
}

if (!empty($lastpublish))
  echo '</table>';

this will open a new table open each new publish day, and will close the
last table tag correctly.
this is an untested code...hope it helps

"Jeff Lewis" <jeff <email protected>> wrote in message
news:004d01c15281$2e8ee4e0$76a1a8c0 <email protected>
I am looping through a set of data retrieved through my database and I want
to break it apart based on the variable called publishday. So the first
time around a new table will need to be started but for each time around I
need to check if a new publishday is encountered. If so, close the previous
table and start a new one.

If anyone understands and can help out, I'd be very appreciative :)

Jeff

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe <email protected>
For additional commands, e-mail: php-general-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>