Day: July 8, 2010

How to fetch multi-lingual content from database

The basic purpose of this post is to guide you all about fetching multilingual content from database.
I mean to say that, if you have stored japanese text in your database, So in order to fetch the japanese content , you need to set the character encoding to UTF-8 format, while communication with the database for fetching the result.

In Case of MYSQLi

query(“SELECT ColumnName FROM tableName “)) {
printf(“Select returned %d rows.\n”, $result->num_rows);

/* free result set */
$result->close();
}
$mysqli->close();
?>

In case you are using multiple database

If you don’t pass in “true” to mysqli_connect() in the example below, $link1 and $link2 will have the same resource id# and both database connections will end up being set to utf-8 charsets.