Jump to content

[SOLVED] Need Help with Upcoming Event


laduch

Recommended Posts

I have a problem with getting the upcoming event work.

Upcoming event is the first event in database after the day the site is visited.

 

in mysql database - day, month, year are "d" - int , "m" - int, "y" -int...

a example row

 

m d y

12 1 2007

 

I know it is a bad practice... I'm just using it for temporary

 

I only need to query out one event to database, the script is like:

 

$query = "SELECT *, STR_TO_DATE(CONCAT(y,'-',m,'-',d), '%Y-%c-%e') AS sort_date FROM events WHERE ADDDATE(NOW(), INTERVAL 300 DAY) = STR_TO_DATE(CONCAT(y,'-',m,'-',d), GET_FORMAT(DATE, 'INTERNAL')) ORDER BY sort_date DESC LIMIT 1";

$result = mysql_query($query, $dbconnect); 

while($row = mysql_fetch_array($result))
{ ...

 

Nothing is shown up... although I have about 10 events in the database.

Link to comment
https://forums.phpfreaks.com/topic/100062-solved-need-help-with-upcoming-event/
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.