Need to count number of rows per id! :(

From: Date: Sat, 03 Feb 2001 02:15:17 +0000
Subject: Need to count number of rows per id! :(
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-37929@lists.php.net to get a copy of this message
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/

« previous php.general (#37929) next »