PEAR Forum :: PHP Extension and Application Repository

PEAR Forum Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
Fatal error: Call to undefined method DB_Error::query() in

 
Post new topic   Reply to topic    PEAR Forum Forum Index -> PEAR
View previous topic :: View next topic  
Author Message
stephros



Joined: 14 Dec 2006
Posts: 2
Location: New Jersy USA

PostPosted: Tue Dec 26, 2006 11:38 pm    Post subject: Fatal error: Call to undefined method DB_Error::query() in Reply with quote

I received this error message:
Fatal error: Call to undefined method DB_Error::query() in c:\wamp\www\_lib\_classes\class.news.php on line 239

the statement prior echo's the include_path which is

c:\wamp\www\_lib\_classes\class.news.php: line 236: include_path ==> C:/wamp/www;C:\wamp\www\_lib\_base;c:\wamp\www\_lib\_classes;c:\wamp\www\site;c:\wamp\www\core;c:\wamp\php\pear;c:\wamp\www\site\news

any ideas why the method is undefined?
Back to top
View user's profile Send private message AIM Address
jnroche



Joined: 14 May 2007
Posts: 2

PostPosted: Mon May 14, 2007 6:15 am    Post subject: almost the same case of mine Reply with quote

i have almost the same error so i probably just post it here as well.

the error was:
Fatal error: Call to undefined method DB_mysql::fetchRow() in d:xampp/htdocs/infinity/includes/config.php on line 23

here is the code:

<?php

//ini_set("include_path", "../../../php/PEAR"); i tried this as well

require_once "DB.php";
$db_host = "localhost";
$db = "infinity";
$db_user = "root";
$db_password = "";
// ONLY USED BY THE PEAR ROUTINES

$db_type = "mysql";
$dsn = DB::parseDSN("$db_type://$db_user:[email protected]$db_host/$db");
$db_obj = DB::factory("$db_type");
if (!$db_status = $db_obj->connect($dsn)) {
echo "Error: " . $db_status -> message . "<br />";
echo "Code: " . $db_status-> code . "<br />";
}

$query = "SELECT * FROM tbl_countryloc";

// NEW STUFF -- Pear specific
$result = $db_obj->simpleQuery($query);
while($row = $db_obj->fetchRow($result,DB_FETCHMODE_ASSOC)) {
$ctr++;
$countryid = $row["countryid"];
$account_address = $row["country"];
print "<P>$countryid - $account_address</P>";
}
?>

***I have a xampp package installed with PEAR-ready package (XAMPP for windows version 1.6.1)
***i have winxp
***this is my very first attempt to use PEAR and I just could not start it right.
***And I think me and the stephros have basicall the same type of error

One more thing i notice though is that running PEAR list i get windows error: 'This application has failed to start because intl3_svn.dll was not found. Re-installing the application may fix this problem'.
--and i tried reinstalling XAMPP to no avail. Is something wrong with XAMPP? anything i can do to verify if PEAR was installed properly??

Im really new to PEAR.
HELP HELP
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger MSN Messenger
mark



Joined: 07 Jan 2007
Posts: 1235

PostPosted: Mon May 14, 2007 9:29 am    Post subject: Reply with quote

You'll get the "Call to undefined method" error because you don't check the result of the simpleQuery() call. Modify it like this:
Code:

$result = $db_obj->simpleQuery($query);
if (PEAR::isError($result)) {
    die($result->getMessage() . ', ' . $result->getDebugInfo());
}
while ...


The parseDSN() call is not needed BTW.

And the SVN error message seems to be a bug in XAMPP, something similar was recently reported in the German PEAR forum. People wrote there about php_svn.dll, and the solution was to search for this filename in the php.ini and to remove the line from there. Maybe this helps in your case, too.
Back to top
View user's profile Send private message
jnroche



Joined: 14 May 2007
Posts: 2

PostPosted: Mon May 14, 2007 11:48 am    Post subject: Reply with quote

thanks mark. after adding the lines u suggested i still get the same problem like nothing has changed. any other ideas?

PS: i dont need to copy the full PEAR folder within my site directory do I?
like, my default PEAR directory that came installed with xampp is in d:xampp/php/PEAR and my site directory is in xampp/htdocs/mysite/

okay, now this get a little interesting for me. i tried commenting out the line within php.ini the line extension=php_svn.dll and tried to run pear list. it gave me a message below:
(no packages installed from channel pear.php.net)

more buffled.

////////////////////
well after a few investegative work on this problem i think i may have found some work around or a solution to this issue:
here is the code i have been trying out after scavenging through PEAR's DB.php::

okay so after the line that goes:
$db = DB::connect($dsn); //assuming all necessary variables for connecting has been defined here is the following code:

...
$query = "SELECT * FROM tbl_countryloc";
$result = $db->simpleQuery($query);

$dbrows = new DB_result($db, $result);
while($arraynew = $dbrows->fetchRow()){
$rowdata = new DB_row($arraynew);
//echo "row count: ".count($rowdata);
$ctr=0;

foreach($rowdata as $key=>$value){
$$key=$value;
echo $key."=".$value."<br>";
}
$ctr++;
}

underlined, highlighted and italized lines are lines missing from the original code i have. after painstakingly scavenging through DB.php of PEAR DB..

pays off!
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger MSN Messenger
mark



Joined: 07 Jan 2007
Posts: 1235

PostPosted: Mon May 14, 2007 2:55 pm    Post subject: Reply with quote

I can't tell you more about the SVN problem. Asking on XAMPP mailing list might help.

You don't need to copy the PEAR directory, you just need to make sure that the directory where you PEAR files are, is in your include_path setting.

Your code isn't easy to read here in the forum (please use the "[ code ]" (without spaces) to make it more readable). Anyway, these "new DB_..." calls are not needed in normal cases.

The normal "workflow" with DB is:
Code:

$query = 'SELECT ...';
$res = $db->query($query);  // simpleQuery() should also work, but I haven't used it yet
if (PEAR::isError($res)) {
    // handle the error
}
while ($row = $res->fetchRow()) {
    // do something with $row
}


You might need to add
Code:
error_reporting(E_ALL);
to your script to investigate what the reasons for your problems are.
Back to top
View user's profile Send private message
yuyo1



Joined: 24 Apr 2009
Posts: 2

PostPosted: Fri Apr 24, 2009 11:46 pm    Post subject: PLEASE PLEASE EHLP ME... Reply with quote

GUYS I HAVE THE SAME PROBLEM ANY HELP ...

THIS IS THE MESSAGE THAT I GET:

Fatal error: Call to undefined method DboSource::connect() in /home2/azec/public_html/greatshop/cake/libs/model/datasources/dbo_source.php on line 110


please reply. I have blue host hosting service....
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    PEAR Forum Forum Index -> PEAR All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



PEAR Forum topic RSS feed 
Powered by phpBB © 2001, 2005 phpBB Group

Provided by Ministry of Web developement