FRIHOSTFORUMSSEARCHFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

need help: Call to undefined function error

 


ammonkc
I keep getting this error when trying to use PEAR DB's numRows() function.

Code:
Fatal error: Call to undefined function: numrows() in /var/www/html/pantours_net/admin/list_users.php on line 36


it works fine on my development server, but when I try the same exact code on my test server it throws that error. this is my script.

Code:
<?php
if ($_SESSION['admin_level'] < 2) {
die('<br /><br /><p align="center">You do not have permission to access this section</p>');
}
require('DB.php');
require('DB/Pager.php');
//require the PEAR::DB classes.
$db_engine = 'mysql';
$db_user = 'panda';
$db_pass = 'panda1234';
$db_host = 'localhost';
$db_name = 'pantours';

$dsn = $db_engine.'://'.
           $db_user.':'.
           $db_pass.'@'.
            $db_host.'/'.
             $db_name;

$db = DB::connect($dsn, TRUE);

if(DB::isError($db)) {
   die($db->getMessage());
}
$db->setFetchMode(DB_FETCHMODE_ASSOC);

$from=0;
if (isset($_GET['from'])) {$from=$_GET['from']; }
if (empty($_GET['from'])) {$from=0; }
$limit = 40;
$nrows = 0;
$maxpages = 10;
$sql = "SELECT * FROM user WHERE user_inactive != '1'";
$total = $db->query($sql);
$res = $db->limitQuery($sql,$from,$limit);
$nrows = $total->numRows();
$data = DB_Pager::getData($from, $limit, $maxpages);
Rhysige
From what I can gather you are using the results incorrectly and the line of code should be
Code:

$nrows = $db->numRows($total);

I could be wrong but from skim reading the code thats what I came up with.
ammonkc
Rhysige wrote:
From what I can gather you are using the results incorrectly and the line of code should be
Code:

$nrows = $db->numRows($total);

I could be wrong but from skim reading the code thats what I came up with.

Thanks that worked. Thats weird because I have been using that function the other way for a long time. it has always worked fine for me on every other server I put it on. for some reason it only gave me that error on that particular redhat server. the problematic server is running an old linux kernel (redhat 3) but the apache and php are both new. anyways thanks for the tip.
Related topics
Need help with an error
Need help with site getting error on http://validator.w3.org
Need help understanding MySQL "Resource" type retu
Need help fixing my php file
BSOD oh no! Need help
Relatively Secure Session Management System for PHP
How to call the method?
Flash Presentation Help
wordpress problem :( need help.. :(
Need help with database, can anyone help?
Navigation Script (javascript) Help Please!
Need help in Borland C++ 3.0
Need help with iTunes..
I have superiority complex and I need help.
Need Help for Banner
Need help with subdomains of my hosting account!
i need HELP
Your online routine
google ad placement problems, need help
Need help with a Database issue.
I need help yet again
hey i need help!!
Need help wi th IPN's ....
accounts........yes i desperately need help.......^^
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.