Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Help with PHP
Index -> Programming, PHP -> PHP Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
nickison99




PostPosted: 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



pic1.JPG
 Description:
Picture1
 Filesize:  21.46 KB
 Viewed:  5337 Time(s)

pic1.JPG


Sponsor
Sponsor
Sponsor
sponsor
nickison99




PostPosted: Wed Aug 04, 2004 11:37 am   Post subject: (No subject)

Any ideas?
nickison99




PostPosted: Thu Aug 05, 2004 11:23 pm   Post subject: (No subject)

Nobody?
Dan




PostPosted: Sat Aug 07, 2004 1:59 am   Post subject: (No 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
Computer Science Canada Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
nickison99




PostPosted: Sat Aug 07, 2004 9:16 am   Post subject: (No subject)

I'll give it a try. THanks.
Display posts from previous:   
   Index -> Programming, PHP -> PHP Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 5 Posts ]
Jump to:   


Style:  
Search: