Jump to content

Archived

This topic is now archived and is closed to further replies.

feri_soft

how to count results?

Recommended Posts

How to coun t results in mysql and display the number of the results.Something like numrows???How exactly

Share this post


Link to post
Share on other sites
SELECT COUNT('some_field_name') FROM `some_table_name` AS total WHERE ...

or were you looking for msql_num_rows()?

Share this post


Link to post
Share on other sites
I think it is:
msql_num_rows()

because i want for example to show how many results there are.I have category design lets say and on the left i want to know how many are the articles in it.I use this

"Select * from articles where cat_id=...."

And then how to show how many are the articles from this category ;)

Share this post


Link to post
Share on other sites
In mysql:
[code]<?php
$q = "Select * from articles where cat_id=....";
$rs = mysql_query($q) or die('Problem with query: ' . $q . '<br>' . mysql_error());
$n = mysql_num_rows($rs);
echo $n;
?>[/code]

Ken

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.