Can't get data from mysql database if field has accents

Can't get data from mysql database if field has accents

si08789si08789 Posts: 15Questions: 6Answers: 0

I am trying to retrieve information from a mysql database but I don't get the fields which contains any accent. On the other hand I can insert and edit data with accents from the editor.

Anyone has any idea on how to say the table to get data in utf-8 format? Maybe it's the key.

Thank you.

Replies

  • allanallan Posts: 63,676Questions: 1Answers: 10,497 Site admin

    Could you try adding the following in your PHP file, immediately after including the DataTables.php file:

    $db->sql("SET character_set_client=utf8");
    $db->sql("SET character_set_connection=utf8");
    $db->sql("SET character_set_results=utf8");
    

    If that doesn't immediately fix the issue, could you try replacing the value for the dsn option in config.php with an empty string (and keep the above code).

    Allan

  • si08789si08789 Posts: 15Questions: 6Answers: 0

    Thank you so much Allan! Now it works perfectly!

This discussion has been closed.