|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2003-08-29 08:49 UTC] cox@php.net
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 09:00:02 2025 UTC |
Description: ------------ Greetings! I have an interesting problem, using prepare() method of interface class DB_Common in package PEAR DB (last version, 1.5.0RC1). According to documentation, it must return resource, but it returns 0! So, I cannot use "execute()". There's no even error! Though, connection is established correctly, and the queries work properly, using such methods as query, getRow, etc. If I use query or get* methods as workaround, for example: $DB->query("SELECT type_name FROM FOO WHERE ?=?", array("type_id", 3)); , then everything goes fine. Reproduce code: --------------- <? require_once ("common/conf/config.inc.php"); // Here the $CONFIG array is defined require_once ("DB.php"); $db_host = $CONFIG['db']['host']; $db_type = $CONFIG['db']['dbtype']; $db_name = $CONFIG['db']['dbname']; $db_user = $CONFIG['db']['user']; $db_pwd = $CONFIG['db']['password']; $dsn = "$db_type://$db_user:$db_pwd@$db_host/$db_name"; $DB = DB::connect($dsn); if (DB::isError($DB)) die ($DB->getMessage()); $prep_stmt = $DB->prepare("SELECT type_name FROM FOO WHERE type_id=?"); if (DB::isError($DB)) die ($DB->getMessage()); // Just to be sure that PEAR still thinks that all is OK echo "PREPARED STATEMENT: '$prep_stmt', type is " . gettype($prep_stmt); ?> Expected result: ---------------- The query handle, of type 'resourse', according to documentation. (I don't know the right output text to be, just because I've never got one). Actual result: -------------- PREPARED STATEMENT: '0', type is integer