Hey, I have a really confusing problem here.
I'm using MSSQL & PHP. I have created a querry in MSSQL that basically shows a list of events and shows them in date order. I have written a bit of code into the mssql statement that says 'If the current date is the friday before the event date, and the event date is on a saturday or sunday, then dont show that event'
when I run that code in mssql it returns the correct results - when its firday the next event it shows is a monday (as it should).
However when i then run this querry in php it does not show the desired results.
For example when php ran this on saturday it showed events for saturday & sunday (when it should show monday onwards). and when running it today it shows events for tuesday (when it should be showing events for monday as well)
My select statement is quite massive so appologies if its confusing
My initial thinking is maybe the date is wrong in php? iis? or mssql?
What do you think?
Thanks so much in advance
I'm using MSSQL & PHP. I have created a querry in MSSQL that basically shows a list of events and shows them in date order. I have written a bit of code into the mssql statement that says 'If the current date is the friday before the event date, and the event date is on a saturday or sunday, then dont show that event'
when I run that code in mssql it returns the correct results - when its firday the next event it shows is a monday (as it should).
However when i then run this querry in php it does not show the desired results.
For example when php ran this on saturday it showed events for saturday & sunday (when it should show monday onwards). and when running it today it shows events for tuesday (when it should be showing events for monday as well)
My select statement is quite massive so appologies if its confusing
Code:
SELECT DISTINCT dbo.events.showPrice, dbo.events.eventID, dbo.events.categoryID, dbo.events.eventName, dbo.events.eventDetails, dbo.events.eventLive, dbo.eventCategories.categoryName, eventCategories_1.categoryName AS categoryParent, dbo.events.enabled, tickets_1.ticketStartDate, MIN(tickets_1.ticketPrice) AS priceFrom, dbo.venues.venueID, dbo.venues.venueName, dbo.venues.venueAddress1, dbo.venues.venueCity, dbo.venues.venueCounty, dbo.texts.text, '1' AS test, (SELECT MIN(ticketStartDate) AS minStart FROM dbo.tickets WHERE (eventID = 184) AND (ticketStartDate > CASE WHEN Datepart(dw, getdate()) <= 6 AND ticketEndDate > getdate() AND ticketEndDate < DATEADD(DAY, 2, GETDATE()) THEN getDate() ELSE DATEADD(DAY, 2, GETDATE()) END)) AS minStart, (SELECT MAX(ticketStartDate) AS maxEnd FROM dbo.tickets AS tickets_2 WHERE (eventID = 184) AND (ticketStartDate > GETDATE())) AS maxEnd FROM dbo.events INNER JOIN dbo.eventCategories ON dbo.events.categoryID = dbo.eventCategories.categoryID LEFT OUTER JOIN dbo.eventCategories AS eventCategories_1 ON dbo.eventCategories.categoryParent = eventCategories_1.categoryID INNER JOIN dbo.tickets AS tickets_1 ON dbo.events.eventID = tickets_1.eventID LEFT OUTER JOIN dbo.venues ON tickets_1.venueID = dbo.venues.venueID LEFT OUTER JOIN dbo.texts ON tickets_1.textsID = dbo.texts.textsID WHERE (tickets_1.ticketEndDate > CASE WHEN Datepart(dw, getdate()) <= 6 AND tickets_1.ticketEndDate > getdate() AND tickets_1.ticketEndDate < DATEADD(DAY, 2, GETDATE()) THEN getDate() ELSE DATEADD(DAY, 2, GETDATE()) END) GROUP BY dbo.events.eventID, dbo.events.categoryID, dbo.events.eventName, dbo.events.eventDetails, dbo.events.eventLive, dbo.events.showPrice, dbo.eventCategories.categoryName, eventCategories_1.categoryName, tickets_1.ticketEndDate, dbo.events.enabled, tickets_1.ticketStartDate, dbo.venues.venueName, dbo.venues.venueID, dbo.venues.venueAddress1, dbo.venues.venueCity, dbo.venues.venueCounty, dbo.texts.text HAVING (dbo.events.eventID = 184) AND (dbo.events.enabled = 1) AND (MONTH(tickets_1.ticketStartDate) = MONTH(GETDATE())) AND (YEAR(tickets_1.ticketStartDate) = YEAR(GETDATE()))
What do you think?
Thanks so much in advance
Comment