Jump to content

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);
?>

 
Link to comment
https://forums.phpfreaks.com/topic/306780-where-date-today/
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.