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>";
}
}
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 **/