php - Counting the numbers of rows in Zend Framework -
php - Counting the numbers of rows in Zend Framework -
in php can utilize function mysqli_stmt_num_rows($stmt) check how much rows there in result set.
i wondering, how if using zend framework. i'm trying accomplish check if email existst in database table: customer.
i have code.
$db = zend_registry::get('db'); $query = "select column1,column2 ". zim_properties::gettablename('customer') ." email = '".$_post['email']."'"; $stmt = $db->query($query);
i utilize zend framework 1.8
what did solve problem following.
to know more info var $stmt
used zend_debug::dump($stmt);
it showed:
object(zend_db_statement_mysqli)#14 (12) {
so went folder "library/zend/db/statement"
, , opened file mysqli.php
.
then checked every method available in class , noticed method rowcount
needed one.
at controller called rowcount function.
$db = zend_registry::get('db'); $query = "select column1,column2 ". zim_properties::gettablename('customer') ." email = '".$_post['email']."'"; $stmt = $db->query($query); echo $stmt->rowcount();
php zend-framework
Comments
Post a Comment