Problems using PDO_MYSQL with MySQL3
| From: | Andreas Korthaus | Date: | Fri, 24 Mar 2006 11:31:31 +0000 |
| Subject: | Problems using PDO_MYSQL with MySQL3 | ||
| Groups: | php.pecl.dev | ||
| Request: | Send a blank email to pecl-dev+get-3649@lists.php.net to get a copy of this message | ||
Hi!
I'm using PDO on server running PHP 5.1.2, MySQL 4.1.14, MySQL 3.23.58 and MySQL 5.0.18. The PDO version, bundled with PHP 5.1.2 is used. PDO_MYSQL as well as the old mysql extension both use MySQL client library version 5.0.18.
I have created a very simple script, which should read data from a table in the MySQL3 database:
$sql = 'SELECT * FROM test';
try {
$dbh = new PDO('mysql:host=localhost;dbname=test', 'user', 'pass');
$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$result = $dbh->query($sql);
var_dump($result);
$row = $result->fetch();
var_dump($row);
}
catch(PDOException $e){
die($e->getMessage());} But this does not work. Connect seems to work, but PDO::query() returns false - I have no idea why. No exception, no SQL error... I have ported this to mysql_* functions, and this works: $sql = 'SELECT * FROM test'; $conn = mysql_connect('localhost', 'user', 'pass'); mysql_select_db("test"); $result = mysql_query($sql); $row = mysql_fetch_assoc($result); var_dump($row); shows a row with data now. If I dump the sql-structure/data from MySQL3 and import it into MySQL4.1 and simply change the PDO script to use the MySQL4.1 hostname, it works like a charme. Any ideas? What's going wrong here? best regads Andreas