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

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -