Codeigniter common select query


This is the codeigniter function for common select query that you need to place in model. and call it from controller. suppose your model name is say “basic_model” than you need to call this function in controller like..


Parameter understanding :

$select           : string of database table column in comma separated or * for all column
$from             : string of database table name
$where          : An associative array in which array key should be table column and array value would be table column value
$group          : an array of database column e.g array(“user_id”) so it gives output as group by user_id
$order           : string of database column with ASC or DESC parameter e.g ‘user_id DESC’
$having        : string of database column with condition say sum(‘coin’) > 0
$limit            : an array of limit string e.g array(“10,0″) so this gives output as limit 0,10
$result_way : string for output way
$echo           : 0 or 1 . if you want the query string from codeigniter than set this value as 1

By changing the query guide functionality you can use this function for other framework or in cms.

2 thoughts on “Codeigniter common select query

Leave a Reply to oakley sunglasses outlet Cancel reply

Your email address will not be published. Required fields are marked *