尽可能地把''和$拆开
例如……id='".$id."'";

解决方案 »

  1.   

    我绝对没有修改id的值,我输出$id,一点问题都没有!
      

  2.   

    两个都拆开,PHP变量在‘’里面就不是变量了
      

  3.   

    echo $id;
    echo $str="update $table set xibie='$xibie' where id='$id'";
    上面两句连一起,试试看是不是能正确输出!
      

  4.   

    提示什么错误?把sql打出来看看。
      

  5.   

    $str="update $table set xibie='$xibie' where id=$id";not '$id'  but $id
      

  6.   

    zeroleonhart(Strong Point:Algorithm) 
    同样是不行
      

  7.   

    blue2004(简单就是快乐)

    echo $id;
    echo $str="update $table set xibie='$xibie' where id='$id'";
    很奇怪,在$str之前的就可以显示,如果执行了$str就不显示$id了,
      

  8.   

    $str="update $table set xibie='$xibie' where id='$id'";
    echo $str;
    给出结果
      

  9.   

    没有执行$str前是
    update zhuanye set xibie='11' where id='6' 
    执行后是
    update zhuanye set xibie='11' where id=''
      

  10.   

    $str="update ".$table." set xibie='".$xibie."' where id='".$id."'";
      

  11.   

    $str="update $table set xibie='".$xibie."' where id='".$id."'";
      

  12.   

    moodkingdom(老鹰披上马甲)
    web_php(C#C++_PHPMYSQL_ASP)
    还是不对
      

  13.   

    <?php
    include("connect.php");
    $db="bookticket";
    $table="zhuanye";
    $xibie=$_GET['xibie'];
    $jibie=$_GET['jibie'];
    $zhuanye=$_GET['zhuanye'];
    $banji=$_GET['banji'];
    $id=$_GET['id'];
    echo $id;
    if(strlen($xibie)!==0)
    {$str1="update zhuanye set xibie='".$xibie."' where id='".$id."'";
    $res=mysql_db_query($db,$str1);
    }
    echo $id;
    echo $str1;
    ?>
      

  14.   

    update zhuanye set xibie='11' where id='6' is $id a number  ???
    is $xibie a number , too ???I see the "6" here is 全角字符.....
      

  15.   

    kongguyoulan163(空谷幽兰163) 
    我的代码贴出来了,你怎么不回复了呢
      

  16.   

    run it under phpmyadmin and see the error message.
      

  17.   

    首先,这个问题不是什么高深问题,所以不要用“高手快进来”这样的字眼。这是一个很基本的调试技能。

    <?php
    include("connect.php");
    $db="bookticket";
    $table="zhuanye";
    $xibie=$_GET['xibie'];
    $jibie=$_GET['jibie'];
    $zhuanye=$_GET['zhuanye'];
    $banji=$_GET['banji'];
    $id=$_GET['id'];
    echo $id;
    if(strlen($xibie)!==0)     //另外,这个条件是错的,只有在判断变量是否为真假采用===,!==比较符号。否则请老老实实用==,可能这才是你不运行sql查询的根源。
    {$str1="update zhuanye set xibie='".$xibie."' where id='".$id."'";
    $res=mysql_db_query($db,$str1)  or die(  'ERROR in mysql query. Error code: '. mysql_errno() . ', error msg: ' . mysql_error() ) ;      ////////按照错误提示输出mysql错误 
    }
    echo $id;
    echo $str1;
    ?>
      

  18.   

    $str="update $table set xibie='$xibie' where id=$id";去掉$id的小分号!
      

  19.   

    把echo $str1;放在if语句里面。这样就可以知道那句sql有没有执行!
    另外,id的类型是什么?你可以用Maguma调试一下
      

  20.   

    update zhuanye set xibie='11' where id='6' 
    你在"6"写重新写一下,就可以了,写成以下这样
    update zhuanye set xibie='11' where id='6' 看到了吗,是不是有点不同,这个我试过了,没错的
      

  21.   

    $str="update $table set xibie='$xibie' where id=$id";去掉$id的小分号!我试过了,这样也是不行.
    还有id是int型的if(strlen($xibie)!==0)     //另外,这个条件是错的,只有在判断变量是否为真假采用===,!==比较符号。否则请老老实实用==,可能这才是你不运行sql查询的根源。
    这个办法我也试过了,同样是不执行
      

  22.   

    如果将这段代码的id直接用数字来写的话,例如
    $str="update $table set xibie='$xibie' where id='6'";
    起他的代码不用改,就可以正确地执行,请问怎么解决??
      

  23.   

    调试sql错误,首先看mysql_error()的输出是什么
      

  24.   

    我用intval函数将$id转换一下:
    $s=intval($id);
    echo $s;
    $str1="update zhuanye set xibie='".$xibie."' where id='$s'";
    最后执行
    echo $str1;
    echo $id;
    echo $s;
    结果输出的结果是:update zhuanye set xibie='666' where id='0'0如果不对$id进行转换,那么输出结果是:
     update zhuanye set xibie='666' where id=''
      

  25.   

    $id=$_GET['id'];
    echo $id;
    参数传入了没有?我怀疑你没有传入参数id.
    用这种办法检测.
    if($_GET['id']!=null)
    {
        $id=$_GET['id'];
    }
    else
    {
       echo "参数没有传入";
    }
      

  26.   

    $str1="update zhuanye set xibie='$xibie' where id='$id'";