How to change the default collation of a database ?

change database collation:

ALTER DATABASE <database_name> CHARACTER SET utf8 COLLATE utf8_general_ci;

change table collation:

ALTER TABLE <table_name> CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;


change column collation:

ALTER TABLE <table_name> MODIFY <column_name> VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci;

Enable Multilingual Support in Mysql

Snippets to Support Multilingual  in MySQL

$mysqli = new mysqli(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_NAME);
$mysqli->set_charset("utf8");  

Resolved : codeigniter call to member function on non object

To Resolve the error add  one more check before looping through the data

Check Added (  foreach ($query && $query->result() as $row)  )

Final Code.

$query = $this->db->query("YOUR QUERY");

foreach ($query  && $query->result() as $row)
{
        echo $row->title;
        echo $row->name;
        echo $row->body;
}