Counting Data

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
FatBoy666
Forum Newbie
Posts: 1
Joined: Sat Jun 08, 2002 9:41 am

Counting Data

Post by FatBoy666 »

Hi, I'm working on a counter.
I want the MySQL database to count rows with a specific content and then the number should be printed on the page.
My problem now is that I'm not very good with MySQL commands, so I don't know what command I have to use for counting rows.
I would be pleased for every suggestion.
User avatar
BDKR
DevNet Resident
Posts: 1207
Joined: Sat Jun 08, 2002 1:24 pm
Location: Florida
Contact:

Counting stuff

Post by BDKR »

It should be count(). Check the manual at mysql.com/doc. However, it should be as simple as
select count(*) as total from table_name where something = something_else
You could also run the query and use the mysql_num_rows() function. Both should get you
into the ballpark.

Later on,
Big Din K.R.
Post Reply