I have ONE input text field and the user can enter a first name, last name, id, email or phone number and it will get that the rest of the users information. However when a user tries to enter a first and last name like Jerry Smith (and this has been happening alot) I get a null value.
What can I do so if the user enters both a first and last name it will return the person and not null.
Here is my code....
//$id = 1234;
//$phone = '555-555-5555';
//$email = '[email protected]';
//$firstname = 'Jerry';
//$lastname = 'Smith';
$fullname = 'Jerry Smith';
if($id || $phone || $email || $firstname || $lastname) {
$data = get_user_info($id, $phone, $email, $firstname, $lastname);
}
function get_user_info($id = null, $phone = null, $email = null, $firstname = null, $lastname = null){
if($id) {
$this->db->or_where('ID', $id);
}
if($phone) {
$this->db->or_where('HomePhone', $phone);
}
if($email) {
$this->db->or_where('HomeEmail', $email);
}
if($firstname) {
$this->db->or_where('FirstName', $firstname);
}
if($lastname) {
$this->db->or_where('LastName', $lastname);
}
$query = $this->db->get($this->my_table);
$member = $query->result_array();
return $member;
}
$id !== FALSE