Jump to content

Sort by field (date)???


kemper

Recommended Posts

I would like to display my data but sorted by date.  I have already had some postponed games, so now the results are not displaying in order of date.  Suggestions are greatly appreciated.  My code is below.  Thank you in advance.

 

    // mySQL Table
    $db_con = mysql_connect(****, ****, ****) or die("Connetion to database failed!");
    mysql_select_db(****);
$division = $_GET['division'];
$sql = "SELECT * FROM `s2007schedules` WHERE division='$division'";
$result = mysql_query($sql) or die(mysql_error());
$i = 0;

    echo "<font face='Arial' size='3'>To report game results, <u>
<a href='http://www.****'>
<font color='#ff0000'>click here<br></font></a></u></font><br><br>\n\n";

echo "</p>
<table width='100%' border='1' cellspacing='0' cellpadding='3' bordercolor='#3c64a0'>";
         
    while ($row = mysql_fetch_array($result)) {
    echo "<tr>
    <td valign='top' width='100%'>
    <table border='1' width='100%' id='table1' cellspacing='0' cellpadding='2'>
	<tr>
		<td width='55%' colspan='3' bgcolor='#3c64a0'><font face='Arial' size='2' color='#ffffff'><b>" . $row['date'] . "</b></font></td>
		<td width='45%' colspan='2'><b><font face='Arial' size='2' color='#ff0000'>
		Status: </font></b><font face='Arial'>" . $row['status'] . "</font></td>
	</tr>
	<tr>
		<td width='2%'> </td>
		<td width='47%'><font face='Arial' size='2'>" . $row['visitor'] . "</font></td>
		<td width='6%'><font face='Arial' size='2' color='#FF0000'><center><b>" . $row['v_score'] . "</b></center></font></td>
		<td width='30%'><font face='Arial' size='2' color='#2b538e'><b> " . $row['time'] . "</b></font></td>
		<td width='15%'><font face='Arial' size='2'><center><b>Game ID:</b></center></font></td>
	</tr>
	<tr>
		<td width='2%'>
		<p align='right'><b><font face='Arial' size='2' color='#FF0000'><center>@</center></font></b></td>
		<td width='47%'><font face='Arial' size='2'>" . $row['home'] . "</font></td>
		<td width='6%'><font face='Arial' size='2' color='#FF0000'><center><b>" . $row['h_score'] . "</b></center></font></td>
		<td width='30%'>
		<a target='_blank' href=" . $row['field_link'] . "><font face='Arial' size='1' color='#ff0000'><b><u>" . $row['field'] . " " . $row['field_no'] . "</u></b></font></a></td>
		<td width='15%'><font face='Arial' size='1'><center>" . $row['gameid'] . "</center></font></td>
	</tr>
</table>
</td>
    </tr>";
    }
echo "</table>\n";

  // mySQL ends

Link to comment
https://forums.phpfreaks.com/topic/47548-sort-by-field-date/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.