I have a problem here thats really puzzling me. I have a MySQL query, that works fine.. for the most part. In the query, Im looking at dates and date ranges from a table, and returning results that are X days old from today. It looks like this:
WHERE tickets.date_created > date_sub(now(), INTERVAL 30 DAY)
Under most conditions, the query works fine. However, if I change the interval to a number between 80 to 97 my script fails to execute. The error I get is:
Error Code: 1366 Incorrect string value: '\xEF\x80\xA6Top...' for column 's' at row 3
Also, tryin 3 months, rather than 90 days doesnt work. There appear to be other numbers in the 100’s that dont work too, however, if I set something like 10000 days, all results return ok.
Is this something in my database? Is it my query? Has anyone seen this with a date interval? What am I doing wrong?
Any thoughts anyone has 🙂
Many thanks!
I’ve found the answer!
There is a function built into our MySQL to strip out HTML and other characters from a returned result. Whilst its not performing any action on the date area (or shouldn’t be) as its in my select statement:
It appears that if I change this to simply
My query then works! Very odd, but I guess Ill have to find another way to work around stripping HTML and the like.