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
https://forums.phpfreaks.com/topic/74479-solved-php-now-issue/
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
https://forums.phpfreaks.com/topic/74479-solved-php-now-issue/#findComment-376375
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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