hi there
i have table consist of 5 columns
it looks like this

id       title                     theme          image     category
1     PHP  tutorial       tutorial self      1.jpg       PHP
2     Javascript tutor   tutorial self      js.jpg      Javascript
3     PHP tutorial 2      tutorial self      ad.jpg    PHP

category here is changed
for ex: how i can count from that the amount of rows containing only PHP
thanks for attention

Recommended Answers

All 5 Replies

Hi,

You can do it with where condition in your mysql query like:

"select * from tablename where category='PHP'";

Try this one...

I know but i would like to count rows containing only php

$query = "select count(*) from tablename where category='PHP'";

here i must use
mysql_num_rows or mysql_fetch_row

$var = mysql_query("SELECT * FROM table WHERE category = 'PHP'");
$rows = mysql_num_rows($var);

- the variable $rows should give you the number of rows where category = 'PHP'.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.