|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2006-11-01 13:38 UTC] guidi dot luca at gmail dot com
Description:
------------
PDO prepare function crash but don't display any error.
i use:
PDO Driver for MySQL, client library version 5.0.18
Reproduce code:
---------------
$pdo = new PDO("mysql:host=localhost;dbname=myDb","myUser","myPass");
$stmt = $pdo->prepare('select username from users where id = ?');
$stmt->execute( array(123) );
$results = $stmt->fetchAll();
Expected result:
----------------
A statement execution
Actual result:
--------------
Fatal error: Call to a member function execute() on a non-object in /srv/www/htdocs/index.php on line 21
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 09:00:01 2025 UTC |
Sorry for bad reporting, but non-object is $stmt not $pdo. If i try: $pdo = new PDO("mysql:host=localhost;dbname=myDb","myUser","myPass"); $sql = 'select username from users where id = 1'; foreach ($pdo->query($sql) as $row) { // some code here } I not get the problem, so probably the issue is prepare function.