Reputation: 53
I have this function to check is there a value existing in db or not :
function word_exist($word) {
$sql="SELECT * FROM words WHERE word=`?`";
$result=$connect->prepare($sql);
$result->bindValue(1,$word);
$result->execute();
$num=$result->fetchColumn();
if ($num=0) return true;
else return false;
}
If i use the function like this, it won't work and return invalid output :
if (word_exist("تست")){
echo "1";
}
But it works for english characters , It does not work with persian chars.
How can i solve it ?
Specially the value is existing in the DB, but the function returns false for the persian chars.
Also I used the utf8_encode in function, but not solved !
Upvotes: 0
Views: 64
Reputation: 117
maybe your column encode is the problem, try to alter your table and configure you column to make it support additional language. try to change your options column if your column encode is 'latin1_swedish_ci'...hope it works
Upvotes: 1