dongwuli5105 2016-10-07 14:34
浏览 54

注意:第74行中的数组到字符串转换'where子句'51中的未知列'数组'

I am getting this error when i am trying to pass my id in statusUpdate function. The UPDATE query showing me this error. Can anyone help me to solve this ? Thanks in advance.

 <select class="form-control" name="setstatus">                    
  <option value="0">Not Solved</option>
  <option value="1">Solved</option>
</select>

<?php
$id = $_GET['bugid'];
if($_SERVER['REQUEST_METHOD'] == 'POST'){ 
   $setstatus = $_POST['setstatus'];
   $insertreport = $pd->statusUpdate($_POST, $id ); 
 }
?>
public function statusUpdate($id){
    $setstatus = $_POST['setstatus'];
    $query     = "UPDATE `bugstable` SET `status`= $setstatus WHERE `bugid`= $id ";
    $updated_rows = $this->db->update($query);
     if ($updated_rows) {
      echo "<span class='success'>Successfully.</span>";
    }else {
     echo "<span class='error'>Not Updated !</span>";
     }
}
  • 写回答

1条回答 默认 最新

  • dpg2905 2016-10-07 14:41
    关注

    Well, first of all you must need to pass status param in your function where you are calling:

    $setstatus = intval($_POST['setstatus']);
    $insertreport = $pd->statusUpdate($setstatus,$id); 
    

    Second, than you just need to add first param as status in your function where you define:

    public function statusUpdate($setstatus,$id){
        $query     = "UPDATE `bugstable` SET `status`= $setstatus WHERE `bugid`= $id ";
        /** Your rest code **/
    
    评论

报告相同问题?

悬赏问题

  • ¥15 r包runway详细安装教程
  • ¥15 Html中读取Json文件中数据并制作表格
  • ¥15 谁有RH342练习环境
  • ¥15 STM32F407 DMA中断问题
  • ¥15 uniapp连接阿里云无法发布消息和订阅
  • ¥25 麦当劳点餐系统代码纠错
  • ¥15 轮班监督委员会问题。
  • ¥20 关于变压器的具体案例分析
  • ¥15 生成的QRCode圖片加上下載按鈕
  • ¥15 板材切割优化算法,数学建模,python,lingo