jalmz Posted April 12, 2011 Share Posted April 12, 2011 Hi guys, I would like to get the event for today's date. For Example the date today is April 12, 2011 then in my event calendar i have PhpFreaks birthday - April 12, 2011 Digitalpoint birthday - April 15, 2011 $time_now = time(); $day_before = $time_now - 86400; if ($result = mysql_query ("SELECT dateline, dateline_from, eventid, title FROM vb_event WHERE calendarid = 1 AND dateline_from >= '$day_before' ORDER BY dateline_from LIMIT 5")) { if (mysql_num_rows($result)) { $return = ''; while ($row = mysql_fetch_array( $result )) { $return .= "<a href='/forum/calendar.php?do=getinfo&e=" . $row['eventid'] . "&c=1' title='". $row['title'] . "' style='font-size:11px;'>" . $row['title'] . "</a>, "; } echo rtrim($return, ', '); } } The result of this code is PhpFreaks birthday - April 12, 2011, Digitalpoint birthday - April 15, 2011 I would like to display only the todays event. PhpFreaks birthday - April 12, 2011 Thank you Quote Link to comment Share on other sites More sharing options...
dcro2 Posted April 12, 2011 Share Posted April 12, 2011 Erm.. which column actually has the date in it? Excluding `title`. And what is `dateline_from` supposed to be? Quote Link to comment Share on other sites More sharing options...
jalmz Posted April 12, 2011 Author Share Posted April 12, 2011 ok.. in the Vbulletin table.. table vb_event eventid userid event title allowsmilies recurring recuroption calendarid customfields visible dateline (1201165110) utc (0.00) dateline_from (1202169600) dateline_to dst if our query is dateline_from = 1201165110 , then now how to get this variable (1201165110)? Quote Link to comment Share on other sites More sharing options...
jalmz Posted April 12, 2011 Author Share Posted April 12, 2011 when i echo $day_before 1302533714 then $time_now 1302620114 PhpFreaks birthday dateline 1302605672 dateline_from 1302566400 Quote Link to comment Share on other sites More sharing options...
jalmz Posted April 12, 2011 Author Share Posted April 12, 2011 ok it uses UNIX TIME STAMP $day_before 1302533714 04 / 11 / 11 @ 9:55:14am EST $time_now 1302620114 04 / 12 / 11 @ 9:55:14am EST PhpFreaks birthday dateline 1302605672 04 / 12 / 11 @ 5:54:32am EST dateline_from 1302566400 04 / 11 / 11 @ 7:00:00pm EST Quote Link to comment Share on other sites More sharing options...
jalmz Posted April 12, 2011 Author Share Posted April 12, 2011 Solved.. =) SELECT dateline, dateline_from, eventid, title FROM vb_event WHERE calendarid = 1 AND dateline_from BETWEEN '$day_before' AND '$time_now' ORDER BY dateline_from LIMIT 5 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.