[eluser]dynZack[/eluser]
I'm getting the following error:
A Database Error Occurred
Error Number: 1054
Unknown column 'Array' in 'where clause'
SELECT `id`, `city` FROM (`cities`) WHERE `country_id` = Array
In the controller I call a MCountries::getCountryIDByCode
Code:
$active_countryID = $this->MCountries->getCountryIDByCode($active_country);
Code:
/*getCountryIDByCode*/
function getCountryIDByCode($country_code){
$data = array();
$this->db->select('id');
$this->db->where('code', $country_code);
$Q = $this->db->get('countries');
if ($Q->num_rows() > 0){
$row = $Q->row();
$data = $row['id'];
}
$Q->free_result();
return $data;
}
And then call this:
Code:
$cities = $this->MCities->getCitiesByCountryDropDown($active_countryID)
Code:
/*getCitiesByCountryDropDown*/
function getCitiesByCountryDropDown($country_id){
$data = array();
$this->db->select('id,city');
$this->db->where('country_id', $country_id);
$Q = $this->db->get('cities');
if ($Q->num_rows() > 0){
foreach ($Q->result_array() as $row){
$data[$row['id']] = $row['city'];
}
}
$Q->free_result();
return $data;
}
}
Doesn't getCountryIDByCode return a variable? Why am I getting this error?