Created
December 29, 2014 09:14
-
-
Save arifulhb/745a0e194ea1aeae9ee3 to your computer and use it in GitHub Desktop.
Get total number of records based on keyword and search_by item.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function getTotalSearchNum($keyword, $search_by){ | |
$sql='SELECT cust_sn '; | |
$sql.='FROM (avcd_customer AS c) '; | |
switch ($search_by): | |
case 'name': | |
$sql.='WHERE c.cust_first_name LIKE "%'.$keyword.'%" OR c.cust_last_name LIKE"%'.$keyword.'%" '; | |
break; | |
case 'nric': | |
$sql.='WHERE c.cust_card_id LIKE "%'.$keyword.'%" '; | |
break; | |
case 'card_number': | |
$sql.='WHERE c.cust_id LIKE "%'.$keyword.'%" '; | |
break; | |
case 'car_number': | |
$sql.='WHERE c.cust_car_no LIKE "%'.$keyword.'%" '; | |
break; | |
endswitch; | |
$res=$this->db->query($sql); | |
return $res->num_rows(); | |
}//end function |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment