Zend_Db:如何从表中获取行数? [英] Zend_Db: How to get the number of rows from a table?

查看:95
本文介绍了Zend_Db:如何从表中获取行数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想找出一个表中有多少行.我正在使用的数据库是MySQL数据库.我已经有一个用于fetchAll()之类的Db_Table类.但是我不需要表中的任何信息,而只是行数.如何在不调用fetchAll()的情况下获得表中所有行的计数?

I want to find out how many rows are in a table. The database that I am using is a MySQL database. I already have a Db_Table class that I am using for calls like fetchAll(). But I don't need any information from the table, just the row count. How can I get a count of all the rows in the table without calling fetchAll()?

推荐答案

$count = $db->fetchOne( 'SELECT COUNT(*) AS count FROM yourTable' );

这篇关于Zend_Db:如何从表中获取行数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆