Jump to content
#StayAtHome ×
Sign in to follow this  
TimGreenwood

WHERE $DATE >= Today

Recommended Posts

In the following code block, how do I limit the query to  WHERE $DATE >= Today's date?

(This is OLD code - and I'm neither very good at PHP nor SQL - so be kind.)

(I've looked up every reference I could find and spent hours getting it THIS far - and can't seem to make it over this last hurdle. PLEASE HELP.)

<?
if (!isset($offset)) $offset = 0;
$limit = 32; // this detemines max records per page

$users_query = "SELECT * FROM ItineraryTim ORDER BY date DESC";
$users_limit = " LIMIT " . $offset . "," . $limit;
//$users_limit = " where date>=GetDate() " . $limit;

$users_display = @mysql_query($users_query.$users_limit) or die ("ERROR: The query failed.");


while ($row = @mysql_fetch_array($users_display))
{
	$LINEID = $row["LineID"];
	$LOCATION = $row["Location"];
	$EVENT = $row["Event"];
	$DAYTIME = $row["DayTime"];
	$CONTACT = $row["Contact"];
      $DATE = $row["Date"];
	$TIME = $row["Time"];
     // $DATE = date("F j, Y", $DATE); // Displays ALL dates as January 1, 1970.



//$date = $row['date'];
//echo date("d.m.Y H:i:s", strtotime($date));

// *************** Begin Event Display **********************	
	echo "<center><h2><font color=#bca255>". date("F j, Y", strtotime($DATE)). "</font></h2><p><b>$DAYTIME @ <font color=#993399>$EVENT</font><br>in $LOCATION</b></center><hr><p><p>";
// *************** End Event Display ************************
}

//recordsetNav($mysql_link,$users_query,$PHP_SELF,$offset,$limit,'100%',1);
echo "<a href='mailto:staff@tgm.org?Subject=From TGM Speaking Schedule'>Email us for specific directions.</a>";

@mysql_close($mysql_link);
?>

 

Share this post


Link to post
Share on other sites
SELECT * FROM ItineraryTim ORDER BY date DESC
That's your query. You should already know what the date column in the table is, and the current date is CURDATE().

Share this post


Link to post
Share on other sites

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.

Sign in to follow this  

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