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