I have a table in mysql called messages
. I use the following code to call date from my table and print them.
<?php
$message_query = mysql_query(" SELECT `messages_id`, `from_id`, `message`, `date` FROM `messages` WHERE `group_hash`='$hash' ORDER BY `date` ASC ");
while($run_message = mysql_fetch_array($message_query)){
$message = $run_message['message'];
$print_message = substr($message, 0, 100);
}
echo "$print_message";
?>
I use the function substr() to give me a certain number of characters of the message that will be displayed. Messages are writen in Greek language and stored in field message
which has type = utf8_general_ci. Everything works fine and the message dispalyed correctly. The only problem is that when a word that is printed cutted off, I get at the end of the word a symbol like ? in a rombus. When the word that printed does not cutted off, I don't get it. Any idea how to fix this?