I'm working on a script that retrieves values from a MySQL database for each individual letter within a $word. The script works great, but not for Latin characters like an enye.
Example Code:
$word = "Cañones";
$letters = str_split($word);
print_r($letters);
$query = "SELECT GROUP_CONCAT(Alpha) AS Alpha,
GROUP_CONCAT(Letter_Box_Width) AS Letter_Box_Width
FROM Font_Krinkes
WHERE Alpha IN ('" . implode("','", $letters) . "')";
Output of print_r
Array
(
[0] => C
[1] => a
[2] => ?
[3] => ?
[4] => o
[5] => n
[6] => e
[7] => s
)
PHP Notice: Undefined index: ?
PHP Notice: Undefined index: ?
It seems to me that the enye is being stored and retrieved from my $letters array incorrectly. It's being retrieved as a question mark... Then, of course, the query for the question mark value fails, and this is why I'm getting the Undefined index error. How do I deal with this enye character within my array?
After working through the comments, I realize my code has more issues than just the mb_str_split issue. I'm still unable to query the database correctly.
Any help is much appreciated.