duanshan3065 2014-05-10 22:38
浏览 316
已采纳

“字段列表”中的未知列“名称”

if(isset($_REQUEST['action_t']))
{

    $gender=$_REQUEST['gender'];
    $firstname=$_REQUEST['firstname'];
    $lastname=$_REQUEST['lastname'];
    $sellers=$_REQUEST['sellers'];
    $company=$_REQUEST['company'];


    echo $query=" update register set `name`='$gender' , `f_name`='$firstname' , `l_name`='$lastname' ,`sellers` ='$sellers' ,`company`='$company' WHERE id='$id'";
    mysql_query($query) or die(mysql_error());
    //die();
    echo "<script>alert('You have successfully Updated Your account') </script>";
}
if(isset($_REQUEST['action_p']))
{

    $existing_password=$_REQUEST['existing_password'];
    $npassword=$_REQUEST['npassword'];
    $w=mysql_query("select password from register where id='$id'");
    $ro=mysql_fetch_array($w);
    $password=$ro['password'];
    if($existing_password==$password)
    {
    echo $queryi="UPDATE `register` SET `password`='$npassword' WHERE id='$id'";
    mysql_query($queryi)or die(mysql_error());
    echo "<script>alert('You have successfully Updated Password') </script>";
    }
    else 
    echo "<script>alert('You have Enter Wrong Password') </script>";
}
if(isset($_REQUEST['action_e']))
{

    $email=$_REQUEST['email'];
    $existing_password=$_REQUEST['existing_password'];
    $w=mysql_query("select password from register where id='$id'");
    $ro=mysql_fetch_array($w);
    $password=$ro['password'];
    if($existing_password==$password)
    {
    echo $querye="UPDATE `register` SET `email`='$email' WHERE id='$id'";
    mysql_query($querye)or die(mysql_error());
    echo "<script>alert('You have successfully Updated Email') </script>";
    }
    else 
     echo "<script>alert('You have Enter Wrong Password') </script>";
}
 ?>

My query result update register set name='m' , f_name='dsf' , l_name='dfsf' ,sellers ='Consumer' ,company='fdafa' WHERE id='3

when execute this query in sql it works fine but in my php file it gives me error Unknown column 'name' in 'field list' . I have check my column name already it is right. Meanwhile i change code placement then error is same but column name changed like Unknown column 'f_name' in 'field list'. And secondly my others queries executing successfully but not effect my data base. Also these queries are working fine in mysql.

  • 写回答

1条回答 默认 最新

  • duankuang1046 2014-05-10 22:54
    关注

    Maybe you are using the wrong table/database in PHP?

    echo "<pre>", var_dump( mysql_fetch_assoc( mysql_query("SHOW TABLES") ) ) , "</pre>"
    

    Is the table in the output? If so, is the column in the next output?

    echo "<pre>", var_dump( mysql_fetch_assoc( mysql_query("SHOW COLUMNS FROM register") ) ) , "</pre>"
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 请问一下这个运行结果是怎么来的
  • ¥15 这个复选框什么作用?
  • ¥15 单通道放大电路的工作原理
  • ¥30 YOLO检测微调结果p为1
  • ¥20 求快手直播间榜单匿名采集ID用户名简单能学会的
  • ¥15 DS18B20内部ADC模数转换器
  • ¥15 做个有关计算的小程序
  • ¥15 MPI读取tif文件无法正常给各进程分配路径
  • ¥15 如何用MATLAB实现以下三个公式(有相互嵌套)
  • ¥30 关于#算法#的问题:运用EViews第九版本进行一系列计量经济学的时间数列数据回归分析预测问题 求各位帮我解答一下