Hi guys. I have a problem returning DB results when input string contains backtick (´). Here is my starting point:
Input string: $name = "Church´s"
Function call: $result = $myDB->getLabelDataByName(mysql_real_escape_string($name));
DB encoding: UTF8
Table encoding: UTF8
There is only one recording named Church´s
This function returns 0 rows:
public function getLabelDataByName($labelName)
{
$sql = "
SELECT *
FROM sl_label
WHERE name = '$labelName'";
$this->query($sql);
return $this->query_result;
}
This function returns 1 row:
public function getSearchResultForLabels($input)
{
$sql = "SELECT id,name
FROM sl_label
WHERE name LIKE '$input%'
ORDER BY name ASC";
$this->query($sql);
return $this->query_result;
}
The following string works if I run it from phpMyAdmin:
SELECT * FROM sl_label WHERE name = 'Church´s'
Does that mean that mysql_query() function has a bug?
Or is there an encoding problem?
Any help appreciated.