RE: [PHP-DB] count function?

From: Date: Fri, 30 Mar 2001 18:06:42 +0000
Subject: RE: [PHP-DB] count function?
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-8041@lists.php.net to get a copy of this message
I think you have to run multiple queries, ie run some loop after finding out what topics you wil count from e==> run a select distinct to get the topics run a while or for loop then run queries again like count(*) where topic='$topic' etc then echo the result to each line -----Original Message----- From: DC [mailto:dave_news@NOSPAM-davecarrera.com] Sent: Friday, March 30, 2001 9:53 AM To: php-db@lists.php.net Subject: Re: [PHP-DB] count function? Ok i think i need to expand my help request... my fault.... I have a db that uses ids for topics in a message board ie each topic has messages of various numbers in them. >From my select a topic page i hope to put the number of messages in the topic, so it visually looks like this sort of... topic 1 bbbbbb (5 posts) topic 2 ffffff (2 posts and so on. The only constant i can see in the tables is my posts table which specifies the topic id number. So i think i am asking how can i count the number of the same topic id numbers and show that next to the relevant topic. Thanks Again Dave C "Andrei Skorokhod" <skorokh1@msu.edu> wrote in message news:4.3.2.7.0.20010330124254.0455c4d0@pop3.norton.antivirus... > if you just need the number > > SELECT COUNT(*) FROM table where ................ > > At 06:34 PM 3/30/2001 +0100, DC wrote: > >Hi All > >I cant quite work out how to count the number of rows in my mysql db that > >match a certain critieria and the show that number numericaly in my pages. > > > >Checked books, php.net etc. > > > >Any help is appreciated > > > >Yours Dave C > > > > > > > >-- > >PHP Database Mailing List (http://www.php.net/) > >To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net > >For additional commands, e-mail: php-db-help@lists.php.net > >To contact the list administrators, e-mail: php-list-admin@lists.php.net > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net > For additional commands, e-mail: php-db-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net For additional commands, e-mail: php-db-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.db (#8041) next »