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.

Read More

Mysql set column character set

For converting mysql table character set for particular column than there is below query you can use. here we have change the character set of column say “col1″from default character set type may it Latin type to utf-8. this is support for all language and all characters of world wide.

Also if you want to change the character type of whole table means all column for the table than below query you need to use.

Read More