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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.