[eluser]timboland[/eluser]
I seem to be getting some odd results returning a boolean value from a model. Appears the type is lost when the result gets back to the controller, the controller keeps showing the value as FALSE, when I can see the logic should be returning true. Anyone seen this. Using 1.6.3
MODEL
Code:
function UpdateClientEmail($data)
{
$mybool = true;
//FIRST MAKE SURE A USER DOESN'T EXIST
$this->db->where('clientemail', $data['clientemail']);
$user_exist = $this->db->get('clientemail');
if ($user_exist->num_rows() > 0 )
{
$mybool = false;
}
else
{
$this->db->where('id', $data['id']);
$this->db->update('clientemail', $data);
$mybool = true;
}
return $mybool;
}
CONTROLLER
Code:
function edituserfast($type)
{
//UPDATE
$this->load->model('client/Client_model');
if ($this->Client_model->UpdateClientEmail($_POST))
{
echo $_POST[$type];
}
else
{
echo "User name already exists";
}
}