$sql="select id,title,type_id,time from news limit $offset,$Page_size where type_id=".$type_id; 
echo $sql;
$result=mysql_query($sql) or die($sql."<br/><br/>".mysql_error());; 
while ($row=mysql_fetch_array($result)) 
{   
?> 
<tr> 
<td bgcolor="#E0EEE0" height="25px"><div align="center"> 
<?php echo $row[1]?> 
</div></td> 
<td bgcolor="#E0EEE"><div align="center"> 
<?php echo $row[2]?> 
</div></td> 
<td bgcolor="#E0EEE"><div align="center"> 
<?php echo $row[3]?> 
</div></td> 
<td bgcolor="#E0EEE"><div align="center"> 
<a href="newsChange_ok.php?id=<?php echo $row[0] ?>">修改</a>&nbsp;&nbsp;&nbsp;<a href="#">删除</a>
</div></td> 
</tr>  直接上代码!!!!!错误提示: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 ''0,6' where type_id=21' at line 1 
请问怎么回事啊??????????????????急!!!!!!!!!!!!!!!!!!

解决方案 »

  1.   

    select id,title,type_id,time from news limit $offset,$Page_size where type_id=".$type_id;  修改成select id,title,type_id,time from news where type_id=".$type_id." ORDER BY ID DESC  LIMIT {$offset},{$Page_size}";看看.
      

  2.   

    大神啊!!!!!!!!!!!问题解决了。非常感谢!!!!!!!!!
    还有一些问题能加你qq问你一下么??我是php新手,不会耽误你太多时间。。
      

  3.   

    我已经把所有编码格式设为utf-8了。用的netbeans开发工具,所有生成文件默认都是utf-8,数据库文件也set names utf-8了
      

  4.   

    set names utf8  没有那个横
      

  5.   

    我也是初学者.不好意思 Linux下 一直没找到合适使用的QQ工具,所以没有.webqq不喜欢用.有问题到这问吧,没分的话我可以给你赠送一些。 
      

  6.   

    好的谢谢。
    你还是很有魄力的啊,我只是wubi装的ubuntu和虚拟机的fedora  mint,也没有真正告别windows呢而且我搭建lamp环境时出了点问题,有空交流一下啊
      

  7.   

    前端浏览器就是utf-8编码
    数据库编码也对,文件编码都是统一用netbeans生成的utf-8文件
    就是只出现问号?????,并没有别的乱码。。