Jump to content

[SOLVED] Need help with ?x='tid'


SNN

Recommended Posts

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...

Link to comment
https://forums.phpfreaks.com/topic/54061-solved-need-help-with-xtid/
Share on other sites

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

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>');
}

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 :P

 

Thanks for trying to help, I just forgot about what I used in the project to use the script :P

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.