这是我的一段代码:
if($validentry==0){
$sql="select blog_entries.*, blog_categories.cat from blog_entries, blog_categories where blog_entries.cat_id=blog_categories.id order by dateposted DESC LIMIT 1;";

}
else{//否则显示用户选中的文章
$sql="select blog_entries.*, blog_categories.cat from blog_entries, blog_categories where blog_entries.cat_id=blog_categories.id and blog_entries.id= " . $validentry . " order by dateposted DESC LIMIT 1;";
}这个代码应该没有错,可浏览器总是显示如下:
invalid query:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'by dateposted DESC' at line 1
这是怎么回事,求各位有经验的人帮帮忙!!!!!!