Jump to content

Display data from + and - 7 days using curdate.


kingsbest

Recommended Posts

Hi All,

  I'm trying to display the results of fixtures played in the last week and the forthcoming fixtures for the next week, can anyone tell me what's wrong with my code please as im getting an error and im not even sure if this will display what i want? Please keep in mind that im a newbie at PHP thanks.

 

<?php include("includes/db_connect.php");
mysql_select_db($dbname, $con) or die ($dbname);

$result = mysql_query("SELECT * FROM scorecards WHERE date <= curdate() AND date >= DATE_SUB(curdate(), INTERVAL 7 day) ORDER BY  DESC LIMIT 10");
while ($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td colspan=\"5\">" . $row['date'] . "</td>";
echo "</tr>";
echo "<tr>";  
echo "<td class='h5'>" . $row['home_grade_total'] . "</td>";
echo "<td class='h5'><a href='teamhistory.php?name_URL=".$row['home_team']."'>" . $row['home_team'] . "</a></td>";
echo "<td class='h5'>" . $row['result'] . "</td>";
echo "<td class='h5'><a href='teamhistory.php?name_URL=".$row['away_team']."'>" . $row['away_team'] . "</a></td>";
echo "<td class='h5'>" . $row['away_grade_total'] . "</td>";
echo "</tr>";

}
echo "</table>";
mysql_close($con);
?>

Best wishes,

John.

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.