im currently having problem with Codigniter
here is my code
public function move($data)
{
$sku = $data['sku'];
$store = $data['store_id'];
$sql = "SELECT * FROM products WHERE sku = ? AND store_id = ?";
$query = $this->db->query($sql, array($data['sku'], $data['store_id']));
if($query->result_array() != "") {
$data['qty'] = $data['qty'] + $query['qty'] ; //Error here
$insert = $this->db->query('products', $data);
return ($insert == true) ? true : false;
}
else{
}
}
where i run the project i get this error
Type: Error
Message: Cannot use object of type CI_DB_mysqli_result as array
Filename: C:\xampp\htdocs\index\stock\application\models\Model_products.php
i have already surfed for a solution but i cant solve the problem
can someone help me?
var_dump($var);or even better to use a debugger. The variable $query doesn't store the result.