Skip to content
Advertisement

Date filter function with SQL doesn’t work

I have a website where I load various activities who all have a specific date. I want to filter on those dates.

I do that with this query:

If there is no date given, the page will load all the activities, but if someone wants to select a specific date to see which activities there are on that date, I use this code:

The page loading of all the activities is working fine, but if I select a specific date, the array with activities stays empty and no activities will load.

Advertisement

Answer

Since the column is Datetime , in your sql , you are injecting timestamp value , so that cause that yor result is always empty .

Instead , you can convert Date given to datetime with the same format ‘Y-m-d-h-m’ using gmdate:

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement