I'm trying to pass as Array as parameter
to Stored Procedure
in my Code-Igniter
application. When I'm print that array it gives me correct result of selected values. But it gives me an error in my model function.
Here is my controller:
public function index()
{
$propertyType=$this->input->post('property_type');
$area=$this->input->post('area_id');
$clustersID['cluster']=$this->input->post('cluster_id');
$stageId=$this->input->post('property_status');
print_r($clustersID);
$data['properties'] = $this->p->getPropertyByAreaCluster($propertyType, $area, $clustersID, $stageId);
// echo "<pre>";
// print_r($data['properties']);
// echo "</pre>";
// exit();
//$data['props'] = $this->p->PropView($propId);
$this->load->view('template/header', $data);
$this->load->view('Property/property_view', $data);
$this->load->view('template/footer');
}
Here is my Model:
public function getPropertyByAreaCluster($propertyType, $area, $clustersID, $stageId)
{
$query = $this->db->query("call fetch_propertyType_Area_Cluster_Stage($propertyType,$area,$clustersID,$stageId)");
if ($query) {
$data = $query->result();
$query->next_result();
$query->free_result();
return $data;
}else{
return false;
}
}
Error:
A PHP Error was encountered Severity: Notice
Message: Array to string conversion
Filename: models/Property_m.php
Line Number: 26
Backtrace:
File: /opt/lampp/htdocs/livemg/application/models/Property_m.php Line: 26 Function: _error_handler
File: /opt/lampp/htdocs/livemg/application/controllers/Property.php Line: 61 Function: getPropertyByAreaCluster
File: /opt/lampp/htdocs/livemg/index.php Line: 315 Function: require_once
A Database Error Occurred Error Number: 1054
Unknown column 'Array' in 'field list'
call fetch_propertyType_Area_Cluster_Stage(0,0,Array,0)
Filename: models/Property_m.php
Line Number: 26