Jump to content

[SOLVED] whats wrong with my query??


mike12255

Recommended Posts

I got the following table:

 

$page = $_GET['page'] * 10;
$tolimit = 10;
print "<table class='maintable'>";
print "<tr class='headline' color = 'white'><td width=20%>Author</td><td width=80%>Post</td></tr>";
$gettopic="SELECT * from forumtutorial_posts where postid='$id' AND area ='math' LIMIT $page $tolimit";

$gettopic2=mysql_query($gettopic) or die("Could not get topic");
$gettopic3=mysql_fetch_array($gettopic2);
print "<tr class='mainrow'><td valign='top'>$gettopic3[author]</td><td vakign='top'>Last replied to at $gettopic3[showtime]<br><hr>";
//print  "<A href='deletetopic.php?id=$id'><img src='images/edit-btn.gif'  height='25'align='right'</a> ";
$message=strip_tags($gettopic3['post']);
$message=nl2br($message);
print "$message<hr><br>";
if ($record['locked'] < 1 || ($session->isAdmin())){
print "<a href= 'reply.php?id=$id' ><img src='images/quote-btn.gif'  height='25' align='right'></a>";
}
print "</td></tr>";
$getreplies="Select * from forumtutorial_posts where parentid='$id' order by postid ASC"; //getting replies
$getreplies2=mysql_query($getreplies) or die("Could not get replies");
while($getreplies3=mysql_fetch_array($getreplies2))
{
   print "<tr class='mainrow'><td valign='top'>$getreplies3[author]</td><td vakign='top'>Last replied to at $getreplies3[showtime]<br><hr>";
   $message=strip_tags($getreplies3['post']);
   $message=nl2br($message);


   print "$message<hr><br>";

if ($record['locked'] < 1 || ($session->isAdmin())){
print "<a href= 'reply.php?id=$id' ><img src='images/quote-btn.gif'  height='25' align='right'></a>";
}

}

   //print "</td></tr>";

print "</table>";

 

The Im getting the error that the following line is told to give:

 

$gettopic2=mysql_query($gettopic) or die("Could not get topic");

 

The URL is

 

 

I dont know what is wrong with my query when i change "id" to 22 and do sql in phpmyadmin it works.

Link to comment
https://forums.phpfreaks.com/topic/145653-solved-whats-wrong-with-my-query/
Share on other sites

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.