mike12255 Posted February 17, 2009 Share Posted February 17, 2009 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 http://www.schoolworkanswers.com/message.php?page=1&id=25&catagory=math 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 More sharing options...
Cal Posted February 17, 2009 Share Posted February 17, 2009 $gettopic2=mysql_query($gettopic) or die(mysql_error()); use that to determine the error. Link to comment https://forums.phpfreaks.com/topic/145653-solved-whats-wrong-with-my-query/#findComment-764655 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.