View Single Post
Old 03-26-2006, 05:13 AM   #2 (permalink)
redhead
Newbie
 
redhead's Avatar
 
Join Date: Jun 2002
Location: Denmark
Posts: 1,711
redhead is on a distinguished road
This obvius belongs here, so now it's been moved..
How about somethign like this:
PHP Code:
$query=mysql_query("SELECT * FROM np_categories");
while(
$rowmysql_fetch_array($query))
{
     
$data=mysql_query("SELECT COUNT (*) FROM np_articles WHERE article_category_id = $row[category_id]");
     
$i_row=mysql_fetch_array($data);
     echo 
$row["category_name"] . " (" $i_row[0] . ")"

Or perhaps something like this:
PHP Code:
$query=mysql_query("SELECT * FROM np_categories");
while(
$row=mysql_fetch_array($query))
{
     
$data=mysql_query("SELECT * FROM np_articles WHERE article_category_id = $row[category_id]");
     
$i=mysql_num_rows($data);
     echo 
$row["category_name"] . " (" $i ")"

__________________
Don't worry Ma'am, We're university students, We know what We're doing.
-----
If you pull the pin, Mr.Grenade would no longer be your friend.
-----
01000111 01101111 00100000 01000011 00100000 00100001
redhead is offline   Reply With Quote