PHP Fatal error: Call to undefined method DB_Error::query()

Posted on 2007-11-29
Last Modified: 2013-12-12
I'm using Zend Core for Oracle. I have a file called PTutil.php connects to oracle DB, query the DB and display results.

Currently I'm unable to make work due to this error:

PHP Fatal error:  Call to undefined method DB_Error::query() in ../Phonetimes/PTutil.php on line 192

The line 192 is this:

$res =& $db->query($query);

PEAR is installed and working fine.

I did some google search on this error, and tried what were suggested but still have the same error.

Can you please help me solve this error?

Question by:bprof2007
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
LVL 21

Expert Comment

ID: 20376382

$res =& $db->sql_query($query);

Author Comment

ID: 20376418
Thank I've tried it and got this error:

PHP Fatal error:  Call to undefined method DB_Error::sql_query() in ../PTutil.php on line 193

LVL 21

Expert Comment

ID: 20378016
which wrapper class are you using for mysql functions?
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now


Author Comment

ID: 20383634
I'm using a file called DB.php here are some info from the file itself about what it does?

 * Database independent query interface
 * PHP versions 4 and 5
 * LICENSE: This source file is subject to version 3.0 of the PHP license
 * that is available through the world-wide-web at the following URI:
 *  If you did not receive a copy of
 * the PHP License and are unable to obtain it through the web, please
 * send a note to so we can mail you a copy immediately.
 * @category   Database
 * @package    DB
 * @author     Stig Bakken <>
 * @author     Tomas V.V.Cox <>
 * @author     Daniel Convissor <>
 * @copyright  1997-2005 The PHP Group
 * @license  PHP License 3.0
 * @version    CVS: $Id: DB.php,v 1.80 2005/02/16 02:16:00 danielc Exp $
 * @link

I didn't work with OO in PHP before. :(
LVL 21

Expert Comment

ID: 20386427
The error is basically due to the function query() being undefined. Why dont' you use straight off the oci8 methods. And then you can use oci_fetch_array() to fetch out any results you want, much like mysql functions.

$conn = oci_connect('scott', 'tiger', 'orcl');
$query = 'SELECT myclob FROM mytable WHERE mykey = :mykey';
$stid = oci_parse ($conn, $query);
oci_bind_by_name($stid, ":mykey", $mykey, 5);
oci_execute($stid, OCI_DEFAULT);

Open in new window


Author Comment

ID: 20397786
Thanks much nizsmo for the code.

Can you please explain to me what is mykey in this line:

oci_bind_by_name($stid, ":mykey", $mykey, 5);

I'm not sure why its needed.

I'm also getting this error:

Fatal error: Call to a member function fetchInto() on a non-object in /usr/local/Zend/apache2/htdocs/test.php on line 93

93:while ($res->fetchInto($row)) {

I'm really n00b in pear and connecting to oracle.

LVL 21

Expert Comment

ID: 20398796
not too sure what fetchInto does? but have you set the $row variable?
You can fetch the results from the OCI connection using this function:

Also in case you are still wondering about the oci_bind_by_name() function:

Hope this helps!
LVL 21

Accepted Solution

nizsmo earned 250 total points
ID: 20398801
Forgot to mention, in those sites above there are some nice examples, especially some full examples in oci_fetch_array() link, which will probably answer your questions :)

Author Comment

ID: 20458286
Thanks a lot

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
This video shows setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question