I am having a odd issue, where UNLOCK TABLES causes a syntax error (1064) when used from my code. If it is used through phpmyadmin or the mysql client it works fine. I am have mysql version 5.0.77 and PHP version 5.3.2.
I am doing a query with 1 select, followed by 2 updates and 1 insert, and I am locking the table first and unlocking it afterwords. Note I have tried it with both a user with LOCK TABLES privileges as well as root, and again, it works for both of these cases in phpmyadmin and in mysql client.
I isolated the error to being just the UNLOCK TABLES; command.
code that fails:
Code: Select all
<?php
mysql_connect('localhost', 'username', 'password');
mysql_select_db('database');
$query = "LOCK TABLE nav WRITE; UNLOCK TABLES;";
$result = mysql_query($query) or die(mysql_error());
print '<br><br>';
print mysql_num_rows($result) . ' Rows returned<br><br>';
print mysql_affected_rows() . ' Rows Affected<br>';
?>I have read the mysql docs for LOCK TABLES and have found no reason it doesn't work.
Anyone have any idea whats going on here?
Thanks