php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #38736 PDO prepare() or query() always fails, MySQL
Submitted: 2006-09-07 01:31 UTC Modified: 2006-09-07 02:17 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: mjsabby at gmail dot com Assigned:
Status: Not a bug Package: PDO related
PHP Version: 5.1.6 OS: Fedora Core 5
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: mjsabby at gmail dot com
New email:
PHP Version: OS:

 

 [2006-09-07 01:31 UTC] mjsabby at gmail dot com
Description:
------------
PHP 5.1.6
MySQL 5.0.19-standard
Fedora Core 5

prepare() or query() alwyas fails, regardless of syntactically correct SQL or not, atleast for MySQL.

MySQL(i) client libraries work perfectly, but the PDO with the exact same query fails.

Reproduce code:
---------------
<?php

define('DB_DSN', 'mysql:localhost;dbname=xxx');
define('DB_USER', 'xxx');
define('DB_PASS', 'xxx');

try {
  $dbh = new PDO(DB_DSN, DB_USER, DB_PASS);
} catch (PDOException $e) {
  die($e->getMessage());
}

$query = $dbh->query("SELECT * FROM users") or echo("BOO");
$prepa = $dbh->prepare("SELECT * FROM users") or echo("BOO2");

$dbh = null;

?>

Expected result:
----------------
Run the query


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-09-07 02:17 UTC] mjsabby at gmail dot com
See Bug #38737
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jan 15 08:01:29 2025 UTC