Forum Moderators: coopster
xmlhttp.open("GET","customer_result.php?name="+encodeURIComponent(str),true);
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$colname1_PersonResults = "-1";
if (isset($_GET['name'])) {
$colname1_PersonResults = $_GET['name'];
}
$query_PersonResults = sprintf("SELECT * FROM owners WHERE firstname_en LIKE %s OR lastname_en LIKE %s", GetSQLValueString("%" . $colname1_PersonResults . "%", "text"),GetSQLValueString("%" . $colname1_PersonResults . "%", "text"));
$PersonResults = mysql_query($query_PersonResults, $connection) or die(mysql_error());
$row_PersonResults = mysql_fetch_assoc($PersonResults);
$totalRows_PersonResults = mysql_num_rows($PersonResults);
?>
MySQL connection collation: utf8_general_ci
The table field collations are set as: utf8_unicode_ci
<?php
/*Adding MySQL UTF-8 Support*/
mysql_query("SET NAMES 'utf8'");
mysql_query("SET CHARACTER SET 'utf8'",$connection_name);
mb_internal_encoding("UTF-8");
?>
<?php
/*Adding MySQL UTF-8 Support*/
mysql_query("SET NAMES 'utf8'", $ashrafeya_admin);
mysql_query("SET CHARACTER SET 'utf8'",$ashrafeya_admin);
mb_internal_encoding("UTF-8");
?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$colname1_PersonResults = "-1";
if (isset($_GET['name'])) {
$colname1_PersonResults = $_GET['name'];
}
mysql_query("SET NAMES 'utf8'", $ashrafeya_admin);
$query_PersonResults = sprintf("SELECT * FROM owners WHERE firstname_en LIKE %s OR lastname_en LIKE %s", GetSQLValueString("%" . $colname1_PersonResults . "%", "text"),GetSQLValueString("%" . $colname1_PersonResults . "%", "text"));
$PersonResults = mysql_query($query_PersonResults, $connection) or die(mysql_error());
$row_PersonResults = mysql_fetch_assoc($PersonResults);
$totalRows_PersonResults = mysql_num_rows($PersonResults);
?>