That did the trick. Thank you, Mike!
--- In [email protected], "Mike" <[EMAIL PROTECTED]> wrote: > > your $countresult only has 1 row in it - the row that contains the result of > the query and contains the number you are seeking. when you asked for mysql_num_rows - which is 1, it printed 1. > > Try fetching the row - then get the number from the row array - like this > > $row = mysql_fetch_array($countresult); > $replies = $row['COUNT(*)']; > > print $replies; > > ----- Original Message ----- > From: Jer > To: [email protected] > Sent: Tuesday, September 19, 2006 9:32 AM > Subject: [php_mysql] Re: Creating a message board...reply count > > > I used this code...but it only prints a 1: > > $countquery = "SELECT COUNT(*) > FROM mb_reply > WHERE mb_parent = $threadid"; > $countresult = mysql_query($countquery) or die(mysql_error()); > $replies = mysql_num_rows($countresult); > > print $replies; > > What is wrong with this? Can anyone offer any suggestions? > > Thanks for the help thus far. > > Jer > > --- In [email protected], Pete <cgrp@> wrote: > > > > In message <20060918150627.96307.qmail@>, > > kevin myers <shaggy2dope2126@> writes > > >results = mysql_query(SELECT * FROM (reply table name) where MB_PARENT = "$mbid" > > >) > > >$replies = mysql_num_rows($results) > > > > It would be faster to SELECT COUNT(*)... > > > > -- > > Pete Clark > > > > Sunny Andalucia > > http://www.hotcosta.com/comm_1.htm > > > > > > > > [Non-text portions of this message have been removed] > The php_mysql group is dedicated to learn more about the PHP/MySQL web database possibilities through group learning. Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/php_mysql/ <*> Your email settings: Individual Email | Traditional <*> To change settings online go to: http://groups.yahoo.com/group/php_mysql/join (Yahoo! ID required) <*> To change settings via email: mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
