Computer Science Canada

Help with PHP

Author:  nickison99 [ Tue Aug 03, 2004 10:03 am ]
Post subject:  Help with PHP

I have a chunk of code here that displays info from the db.
code:
echo "<table border=1><tr><td><b>ID</b></td><td><b>Division</b></td><td><b>Away</b></td><td><b>Home</b></td><td><b>Time/Date</b></td></tr>";

$scheddb = mysql_query("SELECT * FROM Schedule2005 ORDER BY TimeStamp ASC");
WHILE($sched = mysql_fetch_array($scheddb)) {

echo "<tr><td>$sched[Game_ID]</td><td>$sched[Division_ID]</td><td>$sched[Team_1]</td><td>$sched[Team_1]</td><td>";
print date("D M d, Y g:i a", $sched[TimeStamp]);
echo "</td></tr>";

 
}
echo "</tr></table>";
include ("bottom.tpl");
?>

When outputed it displays like the attachment 'Picture 1'. I need it to display like this:

Sat Apr 03, 2004
1 - Mite - Team 1 - Team 2 - 8:15 am
2 - Mite - Team 3 - Team 4 - 8:15 am

Sun Apr 04, 2004
6 - Novice - Team 3 - Team 4 - 5:00 am
etc...

(the -'s are symbolic of </td><td>)
Each time a new date comes around it shows the table again but with the new date and game info. Is this possible? If it is how can I change it? If more info is needed from me just ask.
Nick

Author:  nickison99 [ Wed Aug 04, 2004 11:37 am ]
Post subject: 

Any ideas?

Author:  nickison99 [ Thu Aug 05, 2004 11:23 pm ]
Post subject: 

Nobody?

Author:  Dan [ Sat Aug 07, 2004 1:59 am ]
Post subject: 

Could you not just add some ifs in the loop to dived the tables by day based on the date?

like:

lastDate = oldestDate

make a new table with lastdata

loop
if thisRowsDate != lastDate then
lastDate = thisRowsDate
make a new table with thisRowsDate
end if
put data in table

end loop

Author:  nickison99 [ Sat Aug 07, 2004 9:16 am ]
Post subject: 

I'll give it a try. THanks.


: