简体   繁体   中英

PHP mysql_num_rows WHERE this equals this

Is it possible to do something like the WHERE clause in a mysql_num_rows statement in PHP? For example, say I have the column "number" in my database. I want to use mysql_num_rows($number) to display how many rows have the number 1. I know the other ways to do this, but it would be much much easier for what I'm doing to be able to use mysql_num_rows with a WHERE clause.

SELECT COUNT(*) cnt FROM tablename WHERE rowname = 1

使用此查询,您不需要 mysql_num_rows ,这在不需要数据本身但需要行数的情况下会增加开销

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM