Goal of formatting:
- Data put into table
- Date formatted to mm/dd/yyyy
- Rows alternating color
This is what I have so far. This puts my query results into a table. I know how to format the date, but not with the code in the format it is below. Any suggestions would be greatly appreciated.
Thanks.
<?php
$db=mysql_connect ("localhost", "username", "password");
mysql_select_db ("dbname", $db);
$result=mysql_query ("select * FROM tablename", $db);
print ("<TABLE BORDER=3>\n");
print ("<TR><TH ALIGN=LEFT>Date</TH><TH ALIGN=LEFT>Race Name</TH><TH ALIGN=LEFT>Time</TH><TH ALIGN=LEFT>Dist.</TH><TH ALIGN=LEFT>City/State</TH>\n");
while ($row=mysql_fetch_row ($result)) {
print ("<TR><TD>$row[6]</TD><TD>$row[0]</TD><TD>$row[1]</TD><TD>$row[2]</TD><TD>$row[3], $row[4]</TD>\n");
}
print ("</TABLE>\n");
mysql_close ($db);
?>