SNN Posted June 3, 2007 Share Posted June 3, 2007 I have said before that I am making a forum software, my friends and I just started today and got excellent performance on this, MySQL is running fine with it, but the only thing is I can't make it like the popular forums, where it's like ?x=viewtopic&u='.$row['id'].' in if(), does anyone see a problem with this code? if($x == $row['id']) { $sql = "SELECT *"; $sql .= "FROM `threads`"; echo('<table width="95%" class="tborder" align=center cellpadding="6" cellspacing="1"> <tr><td class="tcat">'.$row['name'].' </td></tr><tr><td class="alt1">'.$row['post'].'</td></tr></table>'); } It works fine on just a single page with... if ($x == "news") { $sql = "SELECT *"; $sql .= "FROM `threads`"; $thread = mysql_query($sql); if(!$thread) { die(mysql_error()); } print '<table align="center" width="95%" class="alt1" cellspacing="1" cellpadding="6"><tr><td class="tcat" colspan="6"> IRC News</td></tr><tr><th>#</th><th>Thread Name/Post</th><th>Created by</th></tr>'; While($row = mysql_fetch_assoc($thread)) { print "<tr><td>".$row['id']."</td><td><B>".$row['name']."</B><blockquote>".$row['post']."</blockquote> </td><td><a href='?x=viewprofile&u=".$row['userid']."'>".$row['createdby']."</a></td></tr>"; } echo '</table>'; } Any suggestions? Thanks, SNN EDIT: Sorry if this is in the wrong forum, also I know there's a simple answer to this, I just don't know what...too frusterated... Quote Link to comment https://forums.phpfreaks.com/topic/54061-solved-need-help-with-xtid/ Share on other sites More sharing options...
dough boy Posted June 3, 2007 Share Posted June 3, 2007 It might be me but I do not see the ?x=viewtopic that you claim you are having a problem with in the code sample you provided. I also wanted to point out that this is not efficient code. Since you just started, maybe it is just prototype code. Quote Link to comment https://forums.phpfreaks.com/topic/54061-solved-need-help-with-xtid/#findComment-267250 Share on other sites More sharing options...
SNN Posted June 3, 2007 Author Share Posted June 3, 2007 I've been changing it around alot where it eventually came to ?x=tid (just to see if it made a diffrence, I don't know what to expect with PHP), it was originally ?x=viewtopic&x=tid And really it is going to just be a private forum software, just for a few friends and I to use, that's why the code is sort of 'messy/inefficent' lol Quote Link to comment https://forums.phpfreaks.com/topic/54061-solved-need-help-with-xtid/#findComment-267252 Share on other sites More sharing options...
dough boy Posted June 3, 2007 Share Posted June 3, 2007 Well...can you post the code above the if()? Where is the row['id'] being set at? Quote Link to comment https://forums.phpfreaks.com/topic/54061-solved-need-help-with-xtid/#findComment-267254 Share on other sites More sharing options...
SNN Posted June 3, 2007 Author Share Posted June 3, 2007 This is what I had above the if statement: $sql = "SELECT *"; $sql .= "FROM `threads`"; $sql .= "WHERE `id` = 'tid'"; or something like that...I don't remember if I have it as tid or id. EDIT: This is exactly what I have, it shows only a small bar on the page (?x=1) when it's supposed to show the topic name, poster, and post. $sql = "SELECT *"; $sql .= "FROM `threads`"; $sql .= "WHERE `id` = 'id'"; if($x == $id) { $sql = "SELECT *"; $sql .= "FROM `threads`"; echo('<table width="95%" class="tborder" align=center cellpadding="6" cellspacing="1"> <tr><td class="tcat">'.$row['name'].' </td></tr><tr><td class="alt1">'.$row['post'].'</td></tr></table>'); } Quote Link to comment https://forums.phpfreaks.com/topic/54061-solved-need-help-with-xtid/#findComment-267256 Share on other sites More sharing options...
dough boy Posted June 3, 2007 Share Posted June 3, 2007 Well I might be wrong but shouldn't your "tid" be something like $tid or $_GET['tid']? Quote Link to comment https://forums.phpfreaks.com/topic/54061-solved-need-help-with-xtid/#findComment-267258 Share on other sites More sharing options...
SNN Posted June 3, 2007 Author Share Posted June 3, 2007 Hmm, let me try.... Well now it doesn't show anything. Seems that it can't get the row or something.... *shrug* Hey, I just figured it out... I wasn't using the while function like I was using... not used to it since my friend showed me how Thanks for trying to help, I just forgot about what I used in the project to use the script Quote Link to comment https://forums.phpfreaks.com/topic/54061-solved-need-help-with-xtid/#findComment-267261 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.