Re: DB.php, numRows would not count.
| From: | Joe Stump | Date: | Fri, 13 Aug 2004 06:31:39 +0000 |
| Subject: | Re: DB.php, numRows would not count. | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-14094@lists.php.net to get a copy of this message | ||
You're missing a few steps there ...
$sql = "SELECT * FROM table"
$result = $db->query($sql);
if (!DB::isError($result)) {
if ($result->numRows()) {
echo $result->numRows().'<br />';
} else {
echo 'No Rows!';
}
} else {
echo $result->getMessage();} -- Joseph C Stump PHPTraining.net Professional PHP and MySQL Training http://www.phptraining.net (734) 786 0176 On Aug 13, 2004, at 1:54 AM, Louie Miranda wrote:
What could be wrong.. ## code $sql = "select * from refLog"; $q = $dbConn->numRows($sql); ## end of code this one outputs.. DB Error: unknown error in print_r db_error Object ([error_message_prefix] => [mode] => 1 [level] => 1024 [code] => -1 [message] => DB Error: unknown error [userinfo] => [nativecode=0 **] [backtrace] => Array ( [0] => Array ( [file] => /usr/local/lib/php/DB.php [line] => 748 [function] => pear_error [class] => db_error [type] => -> [args] => Array ( [0] => DB Error: unknown error [1] => -1 [2] => 1 [3] => 1024 [4] => [nativecode=0 **] ))Whats wrong? how can i count the row, i think what i did was right. Well, it has errors so its probably wrong. But what? I did just what ihave read on the manual. Is it, should i do? insted query() and on my $sql select count(*) from table? instead?. -- Louie Miranda http://www.axishift.com -- PEAR General Mailing List (http://pear.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php