Are you looking for select topicID, count(*) from $secondtable group by
topicID? This will give you a count of each distinct topicID in
$secondtable.
Julian
--
Julian Wood
Multimedia Developer
University of Calgary
on 2/2/01 6:15 PM, Sandeep Hundal at [EMAIL PROTECTED] wrote:
>
> Hey guys,
>
> I need an answer to a problem I've been trying to work on for days :(
>
> I made a message board, which has a front page which lists Topic
> name, topic started by, and what date. All this info, and the topic
> message is stored in one mysql table. when you click on any of the
> topics, it leads to a page which lists all replies to that topic by
> topic_id.
>
> Now what I want to do is have a listen on the first index page, the
> number of replies for that particular topic. I know I need something
> like select id from $secondtable where topicid=$topicid, and then use
> mysql_num_rows, but I can't figure out how to integrate the first set
> of results from table 1 with the query on table 2.
>
> This is the query on the front page on the main table :
> $query = "SELECT topicid, icon, name, topic, datestamp FROM
> $maintable ORDER by datestamp DESC LIMIT 40 ";
> $result = mysql_query($query);
>
> TIA!
>
> Sandeep
>
> __________________________________________________
> Get personalized email addresses from Yahoo! Mail - only $35
> a year! http://personal.mail.yahoo.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]