Smarty and PEAR DB
| From: | Reynier Perez Mira | Date: | Mon, 11 Apr 2005 16:34:03 +0000 |
| Subject: | Smarty and PEAR DB | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-212811@lists.php.net to get a copy of this message | ||
Hello List:
I'm using PEAR DB and Smarty. The case is that I have to pass a value from a query result to a
Smarty var. I try to paginate results. See the code below:
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
SmartyPaginate::connect();
SmartyPaginate::setLimit(5);
$gbresult = $database->query("SELECT * FROM libro_de_visitas LIMIT " .
SmartyPaginate::getCurrentIndex() . "," . SmartyPaginate::getLimit());
$gbtotal = $database->query("SELECT COUNT(*) AS total FROM libro_de_visitas");
$gbtotal->fetchRow();
SmartyPaginate::setTotal($gbtotal['total']);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
As you can see I need the COUNT value but I not know how get it from query using PEAR. Some body can
help me?
Regards
Reynier Pérez Mira
3ero. Ing. Informática
Entre más inteligente me siento, más me doy cuenta de lo ignorante que soy.