I have an SQL query that used to work without problem in an earlier version of MySQL, but I've now switched to using MySQL 8 and the query just won't work in that new version. I'm using the query from a PHP script. The query is as follows:
$query = "SELECT * FROM memo WHERE (memo_hidden = 0 OR memo_hidden IS null) AND memo_date='".$required_date."' ORDER BY programme_order, rank";
If I try using it, I just get an error message from MySQL that makes no sense at all. That error message is as follows:
"Invalid memo query: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1"
If I change the query as follows, it works fine:
$query = "SELECT * FROM memo WHERE (memo_hidden = 0 OR memo_hidden IS null) AND memo_date='".$required_date."' ORDER BY programme_order";
However, I obviously want the query to order by both fields (programme_order & rank). I can obviously order the return database rows myself using PHP, but I'd prefer not to do that.
If anyone out there understands how to resolve this, please let me know. Massive thanks in advance for any help.