FRIHOSTFORUMSFAQTOSBLOGSDIRECTORY
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.
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.