maxudaskin Posted February 3, 2008 Share Posted February 3, 2008 <table style="border-top:1px #FFFFFF solid" width="774" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="21" height="20" align="center" valign="middle" bgcolor="#333355"> </td> <td width="279" height="20" align="center" valign="middle" bgcolor="#333355"><span class="style26">Subject</span></td> <td width="58" height="20" align="center" valign="middle" bgcolor="#333355"><span class="style26">Posts</span></td> <td width="213" height="20" align="center" valign="middle" bgcolor="#333355"><span class="style26">Last Post </span></td> </tr> <?php $forumsql = mysql_query("SELECT * FROM `forum_catagories` ORDER BY `forum_catagories`.`sort` ASC"); while($forum_row = mysql_fetch_array($forumsql)){ $forumid = $forum_row['cid']; $postssql = mysql_query("SELECT forumid, postid, pid, name, date, time, topicid, type, title, text FROM forum_posts GROUP BY forumid WHERE forumid = '{$forumid}'"); while($posts = mysql_num_rows($post)){ // Line 269 echo "<tr style=\"background-color:#EFF4FB;\" onMouseOver=\"this.style.backgroundColor='#E5EEF9';\" onMouseOut=\"this.style.backgroundColor='#EFF4FB';\">"; echo '<td class="cursor_link" style="border-bottom:1px align="center" valign="middle" #333355 solid" height="30px">'.$forum_row1.'</td>'; echo '<td class="cursor_link" style="border-bottom:1px align="center" valign="middle" #333355 solid">'.$forum_row['name'].'</td>'; echo '<td class="cursor_link" style="border-bottom:1px align="center" valign="middle" #333355 solid">'.$forum_row1.'</td>'; echo '<td class="cursor_link" style="border-bottom:1px align="center" valign="middle" #333355 solid">'.$forum_row1.'</td>'; echo '</tr>'; }} ?> </table> Keeps giving me the error Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/.grable/vzoom/virtualzoom.net/comm/forum.php on line 269 Quote Link to comment https://forums.phpfreaks.com/topic/89242-solved-number-of-rows/ Share on other sites More sharing options...
Stooney Posted February 3, 2008 Share Posted February 3, 2008 Well $post isn't really defined anywhere. I think you mean: while($posts = mysql_num_rows($postssql)){ Quote Link to comment https://forums.phpfreaks.com/topic/89242-solved-number-of-rows/#findComment-456962 Share on other sites More sharing options...
maxudaskin Posted February 3, 2008 Author Share Posted February 3, 2008 That was an issue, but it still isn't working... <table style="border-top:1px #FFFFFF solid" width="774" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="21" height="20" align="center" valign="middle" bgcolor="#333355"> </td> <td width="279" height="20" align="center" valign="middle" bgcolor="#333355"><span class="style26">Subject</span></td> <td width="58" height="20" align="center" valign="middle" bgcolor="#333355"><span class="style26">Posts</span></td> <td width="213" height="20" align="center" valign="middle" bgcolor="#333355"><span class="style26">Last Post </span></td> </tr> <?php $forumsql = mysql_query("SELECT * FROM `forum_catagories` ORDER BY `forum_catagories`.`sort` ASC"); while($forum_row = mysql_fetch_array($forumsql)){ $forumid = $forum_row['cid']; $postssql = mysql_query("SELECT forumid, postid, pid, name, date, time, topicid, type, title, text FROM forum_posts GROUP BY forumid WHERE forumid = '{$forumid}'"); $posts = mysql_num_rows($postssql); echo "<tr style=\"background-color:#EFF4FB;\" onMouseOver=\"this.style.backgroundColor='#E5EEF9';\" onMouseOut=\"this.style.backgroundColor='#EFF4FB';\">"; echo '<td class="cursor_link" style="border-bottom:1px align="center" valign="middle" #333355 solid" height="30px">'.$forum_row1.'</td>'; echo '<td class="cursor_link" style="border-bottom:1px align="center" valign="middle" #333355 solid">'.$forum_row['name'].'</td>'; echo '<td class="cursor_link" style="border-bottom:1px align="center" valign="middle" #333355 solid">'.$posts.'</td>'; echo '<td class="cursor_link" style="border-bottom:1px align="center" valign="middle" #333355 solid">'.$forum_row1.'</td>'; echo '</tr>'; } ?> </table> Quote Link to comment https://forums.phpfreaks.com/topic/89242-solved-number-of-rows/#findComment-456967 Share on other sites More sharing options...
maxudaskin Posted February 3, 2008 Author Share Posted February 3, 2008 I am trying to make it more complicated than it needs to be... <?php //From $postssql = mysql_query("SELECT forumid, postid, pid, name, date, time, topicid, type, title, text FROM forum_posts GROUP BY forumid WHERE forumid = '{$forumid}'"); //To $postssql = mysql_query("SELECT * FROM forum_posts WHERE forumid = '{$forumid}'"); ?> Quote Link to comment https://forums.phpfreaks.com/topic/89242-solved-number-of-rows/#findComment-456970 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.