你的SQL语句错了,应该是limit 1 from news where class='国内新闻',limit和1之间没有逗号

解决方案 »

  1.   

    补充:正确的语句应该是from news where class='国内新闻' limit 1
    条数限制应该放在最后面
      

  2.   

    改成这样了 ,还是报错
    include 'conn.php';
    $sql="select from news where class='$class1' limit $num1";
    $result=mysql_query($sql,$link) or die("查询表失败".mysql_error());
      

  3.   

    You have an error in your SQL syntax======
    表达式 错,就要好好的检查啦
      

  4.   

    include 'conn.php';
    $class1 = "国内新闻";
    $num1 = 1;
    $sql="select * from news where class='$class1' limit $num1";
    $result=mysql_query($sql,$link) or die("查询表失败".mysql_error());
      

  5.   

    $sql="select * from news where class='".$class1."' limit ".$num1;
      

  6.   

    +++
    还要考虑where子句中的变量会不会带有单引号,双引号。用$class1等变量时最好用urlencode($str) 转换一下。
    +++