可以这样循环更新的。
不能更新时,请查询送出的SQL 语句是否正确。

解决方案 »

  1.   

    试过了,我把sql语句里的$classid_up 换成1 在phpmyadmin里运行是可以改的,而且上面这段是我在一个不循环并有效的程序里拿来改成循环的. 就奇怪会出错.
      

  2.   

    mysql_query("UPDATE download_class SET classname = 'test' WHERE classid ='".$classid_up."' LIMIT 1 ;",$conn) or die("出错啦,请返回检查。");这样看看
      

  3.   

    我估计你的错误是在$classid_up=$classid[$i];这里,有可能$classid这个数组里的值不正确,建议你输出来确认一下。mysql_query("UPDATE `download_class` SET `classname` = 'test' WHERE `classid` =$classid_up LIMIT 1 ;",$conn) or die(mysql_error());看下错误信息。最好能输出你的sql 语句,这样更方便查找错误。
      

  4.   

    web_php 说的试了一下不管用.
    擦肩而过 的试的一下,提示错误:
    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 'LIMIT 1' at line 6
    就是说$classid_up是错误的?
    但是之前在
    $classid_up=$classid[$i];
    echo $classid_up;
    试过是可以的,而且每次循环都能echo出来传来的值,一放到sql就不行了
      

  5.   

    mysql_query("UPDATE `download_class` SET `classname` = 'test' WHERE `classid` =$classid_up LIMIT 1",$conn) or die("出错啦,请返回检查。");
    no ";"
      

  6.   

    also inefficacy
    csdn的bbs太破了,附件都不能发
      

  7.   

    "UPDATE `download_class` SET `classname` = 'test' WHERE `classid` =$classid_up LIMIT 1 ;"这里面为什么还加个分号?去掉它试试看。