Jump to content

Displaying Closest Date In The Future


Hilly_2004

Recommended Posts

Hi guys,

 

I've searched through the forums, and haven't found anything that might help me.

 

I have a field in a table called "Fixture_Date" with a 'date' type e.g. YYYY-MM-DD, does anyone know a select query that will select the next upcoming event based on the current date?

 

Thanks for any help you can throw my way!

Link to comment
Share on other sites

Cheers!

 

Works a treat. For anyone else wondering my script looks like:

 

<?php

//Load all fixtures from the database and then ORDER them by Date (nearest date displayed first)

$today = date("Y-m-d");

$result = mysql_query("SELECT * FROM tbl_fixtures WHERE Fixture_Date > '$today' ORDER BY Fixture_Date ASC LIMIT 1", $connect);

//Loop and Get All The Fixtures From The Database

while($myrow = mysql_fetch_array($result))
{

//Prints Results

echo "<p class=\"ColumnTitle\">";		   
echo $myrow['Opponent'];
echo "</p>";
}

?>				

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.