开发者

PHP mysql_num_rows WHERE this equals this

开发者 https://www.devze.com 2023-04-08 00:17 出处:网络
Is it possible to do something like the WHERE clause in a mysql_num_rows statement in PHP开发者_JS百科? For example, say I have the column \"number\" in my database. I want to use mysql_num_rows($numb

Is it possible to do something like the WHERE clause in a mysql_num_rows statement in PHP开发者_JS百科? 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

With this query you don't need mysql_num_rows which is overhead for cases when you don't need the data itself but the number of rows.

0

精彩评论

暂无评论...
验证码 换一张
取 消