If you are running MySQL queries from PHP and include the semi-colon in the SQL query, your query will run just fine on a MySQL 4 database but will fail on a MySQL 3 database.
This doesn’t work in MySQL 3:
$sql = "SELECT * FROM foo;";
but this does:
$sql = "SELECT * FROM foo";
At least this is what I’m seeing, is this a known thing?
According to the PHP docs: ” The query string should not end with a semicolon.”
I assume PHP handles/appends a semicolon to the string for you. But why it’s only failing under MySQL 3 puzzles me too. Sorry I can’t help much.
yes 🙂
Also I have seen some dbs don’t like a whitespaces in their queries:
SELECT name, descr FROM table
won’t work, but
SELECT name,descr FROM table
will.
phpMyAdmin will include the trailing ‘;’ if you tell it to create PHP code, I guess this is a bug.