Faks Posted February 18, 2011 Share Posted February 18, 2011 This is how looks bug looks : :-\ Code echo "<div align='center' class='thread'>Forum</div>"; $forum_select = mysql_query("SELECT * FROM forum") or die (mysql_error()); while ($forum_show = mysql_fetch_array($forum_select)) { $forum_name = mysql_query("SELECT * FROM forum_group"); while($forum_group_name = mysql_fetch_array($forum_name)) { if ($forum_group_name['hosting_forum_group_id'] == $forum_show['hosting_forum_group_id']) { echo "<table width='900' border='1' align='center' cellpadding='0' cellspacing='0'>"; echo "<tr><td colspan='6' style='padding: 7px;color:red'>".$forum_group_name['hosting_forum_group_name']."</td></tr>"; echo "<tr><td style='white-space: nowrap;' align='center' width='1%'>".$forum_show['hosting_forum_icon']."</td>"; echo "<td>"."<a href='/?section=forumview&id=".$forum_show['hosting_forum_id']." '>".$forum_show['hosting_forum_title']."</a><br />".$forum_show['hosting_forum_description']."</td>"; echo "<td width='230'> </td></tr>"; echo "</table><br>"; } } } I Hope to resolve the problem maybe somebody can explain where is my mistake to fix it and resolve it ! Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted February 18, 2011 Share Posted February 18, 2011 It's very bad in terms of efficiency to have a query inside a loop. You can accomplish the same result using one query: <?php $q = "select forum.hosting_forum_icon, forum.hosting_forum_id, forum.hosting_forum_title, forum_group.hosting_forum_group_name from forum, forum_group where forum.hosting_forum_group_id = forum_group.hosting_forum_group_id"; $rs = mysql_query($q); while ($rw = mysql_fetch_array($rs)) { echo "<table width='900' border='1' align='center' cellpadding='0' cellspacing='0'>"; echo "<tr><td colspan='6' style='padding: 7px;color:red'>{$rw['hosting_forum_group_name']}</td></tr>"; echo "<tr><td style='white-space: nowrap;' align='center' width='1%'>{$rw['hosting_forum_icon']}</td>"; echo "<td>"."<a href='/?section=forumview&id={$rw['hosting_forum_id']}'>{$rw['hosting_forum_title']}</a><br />{$rw['hosting_forum_description']}</td>"; echo "<td width='230'> </td></tr>"; echo "</table><br>"; } ?> Of course, you didn't tell us what was wrong with the picture. Ken Quote Link to comment Share on other sites More sharing options...
Faks Posted February 18, 2011 Author Share Posted February 18, 2011 this code won't work because forum_group is different table in database the mistake is secondary forum must be once not twice showed they should be merged under it like in this forum index i hope somebody understand me because as native i having difficulty's to describe it in details . Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted February 18, 2011 Share Posted February 18, 2011 Look at the query again. It uses both tables to do the work. Try it in phpmyadmin to see what it returns. Ken Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted February 18, 2011 Share Posted February 18, 2011 So when you tried the code that kenrbnsn posted, it didn't work? Or did you just not bother to try it? Quote Link to comment Share on other sites More sharing options...
Faks Posted February 18, 2011 Author Share Posted February 18, 2011 this is what i am trying to achieve i have edited image to show it . Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted February 18, 2011 Share Posted February 18, 2011 That wasn't the question. Did you try the code kenrbnsn posted or not? Quote Link to comment Share on other sites More sharing options...
Faks Posted February 18, 2011 Author Share Posted February 18, 2011 yes but i have to modify it but i am going to check it maybe it resolves the problem but as i see the code i am thinking about left join instead double select witch buffers the code sad news bug is still present even with new code ! Quote Link to comment Share on other sites More sharing options...
Faks Posted February 19, 2011 Author Share Posted February 19, 2011 bump :-\ :'( Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted February 19, 2011 Share Posted February 19, 2011 Post your current code. Quote Link to comment Share on other sites More sharing options...
Faks Posted February 19, 2011 Author Share Posted February 19, 2011 at beginning of topic there is Code . Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted February 19, 2011 Share Posted February 19, 2011 If you went back to the original code, then of course the problem still exists. Quote Link to comment Share on other sites More sharing options...
Faks Posted February 19, 2011 Author Share Posted February 19, 2011 i am using code witch were posted and still is the bug i don't use any more mine code .... #echo "<div align='center' class='thread'>Forum</div><table width='900' border='1' align='center' cellpadding='0' cellspacing='0'>"; echo "<div align='center' class='thread'>Forum</div>"; $forum_select = "select hosting_forum.hosting_forum_id,hosting_forum.hosting_forum_title,hosting_forum.hosting_forum_description,hosting_forum.hosting_forum_icon,hosting_forum_group.hosting_forum_group_name from hosting_forum, hosting_forum_group where hosting_forum.hosting_forum_group_id = hosting_forum_group.hosting_forum_group_id" or die (mysql_error()); $forum_selects = mysql_query($forum_select); #echo "<tr><td colspan='6' style='padding: 7px;color:red'>"."Forumu nosaukimi nedarbojas"."</td></tr>"; while ($forum_show = mysql_fetch_array($forum_selects)) { #$forum_name = mysql_query("SELECT * FROM hosting_forum_group"); # while($forum_group_name = mysql_fetch_array($forum_name)) #{ #if ($forum_group_name['hosting_forum_group_id'] == $forum_show['hosting_forum_group_id']) #{ echo "<table width='900' border='1' align='center' cellpadding='0' cellspacing='0'>"; echo "<tr><td colspan='6' style='padding: 7px;color:red'>".$forum_show['hosting_forum_group_name']."</td></tr>"; echo "<tr><td style='white-space: nowrap;' align='center' width='1%'>".$forum_show['hosting_forum_icon']."</td>"; echo "<td>"."<a href='/?section=forumview&id=".$forum_show['hosting_forum_id']." '>".$forum_show['hosting_forum_title']."</a><br />".$forum_show['hosting_forum_description']."</td>"; echo "<td width='230'> </td></tr>"; echo "</table><br>"; #} } here is the new code it even doesn't look like at the beginning at all . also i am granting access to website to you http://hostings.flush.ws/?section=forum user help pass help22 Quote Link to comment Share on other sites More sharing options...
Faks Posted February 20, 2011 Author Share Posted February 20, 2011 again bump that's sad :-\ Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted February 20, 2011 Share Posted February 20, 2011 Have you done any debugging yourself? When I gave you the different mysql query, I didn't say it was going to fix the problem. Ken Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted February 20, 2011 Share Posted February 20, 2011 I haven't seen a statement of what the problem is? Posting an image of something is kind of pointless (especially if the full size image doesn't load) without a statement of what is wrong in that image. Something might look wrong to you, but looks perfectly fine to everyone else because they don't know what the image is supposed to look like. Quote Link to comment Share on other sites More sharing options...
Faks Posted February 21, 2011 Author Share Posted February 21, 2011 well thanks for everybody for trying ! I found my mistake and resolved it by the way mine code is correct only it needed few changes Quote Link to comment 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.