assuming these are your fields:

post_id
admin_id

code would look something like:

<?
Mysql_pconnect("host","user","pass");
Mysql_select_db("db");
$totaladmins=3;
For($i=1;$i<=$totaladmins;$i++)
        {
                $query = "select count(post_id) as Admin1 where
Admin_id=$i";
                $result = mysql_query($query);
                $object = mysql_fetch_object($result);
                $Admin[$i] = $object -> admin_id;
                print("Admin $i has $Admin[$i] posts.");
        }
?>
___________________________________
Ryan Marrs
Web Developer

Sandler & Travis Trade Advisory Services, Inc.
248.474.7200 x 183
248.474.8500 (fax)
www.strtrade.com


-----Original Message-----
From: Dave Carrera [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, May 01, 2002 8:03 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Count and group ?

Hi All

 

I have added a row to my table which inputs which admin user has amended
a record in a table on my db.

 

I have this working but what I would like to do is count how many
instances of the admin id I have stored.

 

So if my list looks like this..

 

Admin_id

1

2

2

2

3

3

3

3

3

2

1

1

Then the result I would like to display is this..

 

Admin (1) = 3 posts

Admin (2) = 4 posts

Admin (3) = 5 posts

 

Basically displaying the total post each admin has made

 

Any help or guidance is very appreciated and thank you in advance

 

Dave Carrera

Php Developer

http://davecarrera.freelancers.net

http://www.davecarrera.com

 

 


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to