Hi, I'm setting an Events Calendar. And I setup for each event a startDate and a endDate, Beginning and End Date for each Event. The thing is I'm trying to display Event Title when a user clicks on a date Calendar. I get the clicked Date, Day, Month and Year and I can only get value for the Event if Day one, Start Day of Event is cliecked or if the Last day , EndDate of Event is clicked... How can i get the mysql rows results for the Days when the evvent occurs, the days between the satrt day and the end day of the event??? My mySQL code on php is this: $mySql = "SELECT id, titlePt, contentTitle, startDate, endDate FROM `Events` WHERE `fkStatus` = 1 AND `fgHolliday` = 0 AND `startDate` = '".$myTimeStampClicked."' OR `endDate` = '".$myTimeStampClicked."' ORDER BY startDate ASC LIMIT 0,".$myLimit; PHP: Please , any help will be great! Thanks!!
Hi fdoze, please try $mySql = "SELECT id, titlePt, contentTitle, startDate, endDate FROM `Events` WHERE `fkStatus` = 1 AND `fgHolliday` = 0 AND '".$myTimeStampClicked."' BETWEEN `startDate` AND `endDate` ORDER BY startDate ASC LIMIT 0,".$myLimit; Code (markup): Regards, Nick
Hey! Thanks. But nop.. I get no rows at all when I click and Event Day. start day, Between day or end Day. any clue?
Hi, I got it working this way: $mySql = "SELECT id, titlePt, contentTitle, startDate, endDate FROM `Events` WHERE `fkStatus` = 1 AND `fgHolliday` = 0 AND `startDate` = '".$myTimeStampClicked."' OR ('".$myTimeStampClicked."' BETWEEN `startDate` AND `endDate`) ORDER BY startDate ASC "; Code (markup):
Hi, You can use MySQL CURDATE() function instead of php variable $myTimeStampClicked inside the query, so you'll be sure that date format is once and the same. Example: If data is stored "d-m-Y" in MySQL and your date in php variable $myTimeStampClicked was formatted "Y-m-d" you'll not get the correct result. Regards, Nick