corillo181 Posted May 31, 2006 Share Posted May 31, 2006 i asked for help before but i still got nothing..this is inside a loop..nd it suposed to count how many is inside of what ever the id is[code]$myquery=mysql_query("select count(*) from comment WHERE p_id='".$onep['p_id']."'")or die(mysql_error());while($times=mysql_fetch_array($myquery)){$rows=mysql_num_rows($times);echo $rows;}[/code]i think the code is self explanatory.. i'm trying to count how many things are in side the table with the same id as the variable id.. Quote Link to comment https://forums.phpfreaks.com/topic/10865-help-with-this/ Share on other sites More sharing options...
poirot Posted May 31, 2006 Share Posted May 31, 2006 Well, if the query is not wrong, you can simply use this:[code]$myquery = mysql_query("SELECT COUNT(...");$rows = mysql_result($myquery, 0);[/code] Quote Link to comment https://forums.phpfreaks.com/topic/10865-help-with-this/#findComment-40583 Share on other sites More sharing options...
wisewood Posted May 31, 2006 Share Posted May 31, 2006 <?php$query = "SELECT * FROM comment WHERE p_id = '$your_variable'";$result = mysql_query($query);$num_rows = mysql_num_rows($query);echo $num_rows;?> Quote Link to comment https://forums.phpfreaks.com/topic/10865-help-with-this/#findComment-40584 Share on other sites More sharing options...
corillo181 Posted May 31, 2006 Author Share Posted May 31, 2006 thanx wise and thanx p for your assistance.. Quote Link to comment https://forums.phpfreaks.com/topic/10865-help-with-this/#findComment-40634 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.