mysql utf-8

This commit is contained in:
Philip Häusler 2011-06-01 18:23:01 +02:00
parent 208c76fcb2
commit 0ee418ffa2
3 changed files with 24 additions and 25 deletions

View File

@ -3,6 +3,6 @@ include ("../include/funktion_db.php");
$con = mysql_connect("localhost", "root", "changeme") or die("connection failed"); $con = mysql_connect("localhost", "root", "changeme") or die("connection failed");
$sel = mysql_select_db("tabel") or die(mysql_error()); $sel = mysql_select_db("tabel") or die(mysql_error());
mysql_query("SET CHARACTER SET utf8;", $sql_connection); mysql_query("SET CHARACTER SET utf8;", $con);
mysql_query("SET NAMES 'utf8'", $sql_connection); mysql_query("SET NAMES 'utf8'", $con);
?> ?>

View File

@ -1,28 +1,27 @@
<?php <?php
function Get_Text ($TextID, $NoError = false) { function Get_Text($TextID, $NoError = false) {
global $con, $error_messages, $debug; global $con, $error_messages, $debug;
if( !isset($_SESSION['Sprache'])) if (!isset ($_SESSION['Sprache']))
$_SESSION['Sprache'] = "EN"; $_SESSION['Sprache'] = "EN";
if( $_SESSION['Sprache']=="") if ($_SESSION['Sprache'] == "")
$_SESSION['Sprache']="EN"; $_SESSION['Sprache'] = "EN";
if( isset($_GET["SetLanguage"])) if (isset ($_GET["SetLanguage"]))
$_SESSION['Sprache']= $_GET["SetLanguage"]; $_SESSION['Sprache'] = $_GET["SetLanguage"];
$SQL = "SELECT * FROM `Sprache` WHERE TextID=\"$TextID\" AND Sprache ='".$_SESSION['Sprache']."'"; $SQL = "SELECT * FROM `Sprache` WHERE TextID=\"$TextID\" AND Sprache ='" . $_SESSION['Sprache'] . "'";
@$Erg = mysql_query($SQL, $con); @ $Erg = mysql_query($SQL, $con);
if( mysql_num_rows( $Erg) == 1) if (mysql_num_rows($Erg) == 1)
return (@mysql_result($Erg, 0, "Text")); return (@ mysql_result($Erg, 0, "Text"));
elseif( $NoError && !$debug) elseif ($NoError && !$debug) return "";
return "";
else { else {
array_push($error_messages, "Get_Text, '$TextID' found ". mysql_num_rows( $Erg). "x in Sprache Database Table for Language (".$_SESSION['Sprache'].")\n"); array_push($error_messages, "Get_Text, '$TextID' found " . mysql_num_rows($Erg) . "x in Sprache Database Table for Language (" . $_SESSION['Sprache'] . ")\n");
return "Error Data, '$TextID' found ". mysql_num_rows( $Erg). "x"; return "Error Data, '$TextID' found " . mysql_num_rows($Erg) . "x";
}
} }
}
function Print_Text($TextID, $NoError = false) { function Print_Text($TextID, $NoError = false) {
echo Get_Text($TextID, $NoError); echo Get_Text($TextID, $NoError);
} }
?> ?>

View File

@ -15,7 +15,7 @@ function ShowMenu($MenuName) {
if ((strpos("00$Key", "0$MenuName") > 0) || ((strlen($MenuName) == 0) && (strpos("0$Key", "/") == 0))) { if ((strpos("00$Key", "0$MenuName") > 0) || ((strlen($MenuName) == 0) && (strpos("0$Key", "/") == 0))) {
$TempName = Get_Text($Key, true); $TempName = Get_Text($Key, true);
if ((true || $debug) && (strlen($TempName) == 0)) if ((true || $debug) && ($TempName == ""))
$TempName = "not found: \"$Key\""; $TempName = "not found: \"$Key\"";
if ($Entry == "Y") { if ($Entry == "Y") {