$query = $this->Products_model->getProductsWhere($product_id); $row = $query->row(); $data = array( 'id' => $row->id 'qty' => 1, 'price' => $row->price, 'name' => $row->name );