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.. 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] 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;?> 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.. Link to comment https://forums.phpfreaks.com/topic/10865-help-with-this/#findComment-40634 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.