Jump to content

[SOLVED] PHP NOW() Issue


dlebowski

Recommended Posts

Hello.  I am running this query below to show only events happening today and forward:

 

SELECT date_FORMAT(AuctionDate, '%M %e, %Y') as newdate, AuctionDescription, AuctionTitle, AuctionDate, AuctionTime, AuctionAddress, AuctionCity, AuctionState, AuctionCity, AuctionZip FROM auctions WHERE AuctionDate >= NOW() ORDER BY AuctionDate

 

For some reason, it only shows values for events GREATER than today.  So today's events are not showing up.  It used to work and now it doesn't.  I recently changed from PHP 4 to PHP 5.  Is there something I need to change with ">= NOW()"?  That is the only think I can think of.  Any suggestions?  I did confirm that the time on my server is correct.  Thanks!

Link to comment
Share on other sites

Here is what I ended up doing to get this to work.  (By the way, I recently upgraded my version of mysql as well)  So there must be something that doesn't jive in the new version of mysql in regards to NOW().

 

Here is what I did to get around it:

$date = date("Y-m-d");
SELECT date_FORMAT(AuctionDate, '%M %e, %Y') as newdate, AuctionDescription, AuctionTitle, AuctionDate, AuctionTime, AuctionAddress, AuctionCity, AuctionState, AuctionCity, AuctionZip FROM auctions WHERE AuctionDate >= '$date' ORDER BY AuctionDate

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.