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 Link to comment https://forums.phpfreaks.com/topic/233480-fetch-recent-event-in-vbulletin-calendar-todays-event/ 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? Link to comment https://forums.phpfreaks.com/topic/233480-fetch-recent-event-in-vbulletin-calendar-todays-event/#findComment-1200547 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)? Link to comment https://forums.phpfreaks.com/topic/233480-fetch-recent-event-in-vbulletin-calendar-todays-event/#findComment-1200554 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 Link to comment https://forums.phpfreaks.com/topic/233480-fetch-recent-event-in-vbulletin-calendar-todays-event/#findComment-1200565 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 Link to comment https://forums.phpfreaks.com/topic/233480-fetch-recent-event-in-vbulletin-calendar-todays-event/#findComment-1200571 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 Link to comment https://forums.phpfreaks.com/topic/233480-fetch-recent-event-in-vbulletin-calendar-todays-event/#findComment-1200581 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.