Consider:
function check($string, $id, $type){
if($type == "edit"){
$sql = "SELECT * FROM test where first = '" . $string . "' and id = " . $id . "";
$query = $this->db->query($sql);
$array = $query->result();
if(!empty($array)){
return true; # Valid
}else{
$this->check($string, NULL, "add");
}
}else{
$sql = "SELECT * FROM test where name = '" . $string . "'";
$query = $this->db->query($sql);
$array = $query->result();
if(empty($array)){
return true;
}else{
return false;
}
}
}
ELSE
will not return the value. I tried this with both a Boolean or string value. How can I fix it?