Hi all,
I am working on a script that displays images using "jquery.nivo.slider.js", one after the other getting the data from a MySQl data table where the conditions are met.
I have two records in the table both with different FromTimes and ToTimes
Record No1 has "FromDate = 21-03-13" and "ToTDate = 21-03-31"
Record No1 has "FromTime = 01:00" and "ToTime = 23:00"
Record No1 has "Day5 = 5"
Record No2 has "FromDate = 21-03-13" and "ToTDate = 21-03-13"
Record No2 has "FromTime = 12:00" and "ToTime = 13:00"
Record No2 has "Day5 = 5"
$NowTime = "12:15" the current time.
$NowDate = "21-03-13" the current date.
The issue I am having is the query return both records if the current time less than $NowTime OR greater than $NowTime.
The query I have is:
SELECT *
FROM ConfPromotions2017
WHERE HotelID = 'EXBHX'
AND DisplayID = 2
AND (Day1 = '5' OR Day2 = '5' OR Day3 = '5' OR Day4 = '5' OR Day5 = '5' OR Day6 = '5' OR Day7 = '5' OR DayALL = 8 AND FromDate >= '".$NowDate."' OR FromDate <= '".$NowDate."'
The query above returns all the records where today's date ($NowDate) is between the $Fromdate and the $ToDate.
Then I need to find a way of displaying the records returned from the query above which is two, I then need to display each image.
Display the first image where the FromDate and the Todate are between the current date and between the current time, which is two.
But only display record No2 if the current time is between FromTime and ToTime
So, the first image displays between 01:00 and 23:00 when the current date is between FromDate and the Todate. Then display the second image when the current date
is between FromDate and the Todate, BUT only when the current time is between FromTime and ToTime.
Is this possible?