note 94774 deleted from function.mysql-set-charset by danbrown
| From: | danbrown@php.net | Date: | Tue, 24 Nov 2009 16:08:40 +0000 |
| Subject: | note 94774 deleted from function.mysql-set-charset by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-163235@lists.php.net to get a copy of this message | ||
Note Submitter: script at musabulut dot de
----
hi. i wrote the following script that working fine:
----------------------------------------------------------
php header
----------------------------------------------------------
<?php
header('Content-Type: text/html; charset=utf-8');
mb_http_input('utf-8');
mb_http_output('utf-8');
//...your code...
?>
----------------------------------------------------------
html head
----------------------------------------------------------
<?xml version='1.0' encoding='utf-8' ?>
//...your code...
<head>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
//...your code...
</html>
----------------------------------------------------------
php database connection function
----------------------------------------------------------
<?php
function dbconnect() {
$db_vb_id = @mysql_connect($db_host, $db_user, $db_password);
if (!$db_vb_id) {
$errors['database']['connect'] = "error";
} else {
$db_wahl = @mysql_select_db($db_name, $db_vb_id);
if (!$db_wahl) {
$errors['database']['select'] = "error";
} else {
@mysql_query("SET character_set_results = 'utf8', character_set_client =
'utf8', character_set_connection = 'utf8', character_set_database =
'utf8', character_set_server = 'utf8', SET collation_connection =
'utf8_general_ci', SET collation_database = 'utf8_general_ci', SET
collation_server = 'utf8_general_ci'", $db_vb_id);
@mysql_set_charset('utf8', $db_vb_id);
@mysql_query("SET NAMES 'utf8'", $db_vb_id);
}
}
}
//...your code...
?>
----------------------------------------------------------
i hope it will be usefull
musa bulut