Inserting special characters into the database - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: Inserting special characters into the database (/showthread.php?tid=79294) |
Inserting special characters into the database - mktek - 05-25-2021 Hello, I want to insert special characters into the database with builder. For example: ???? When I send a query these special characters ??? as added to the database. What can I do for it? I am using the utf8mb4 character set in the database. The problem is not in the database. The DB Builder neutralizes these characters. RE: Inserting special characters into the database - php_rocs - 05-25-2021 @mktek, Please show us your code. This will give us a better idea how to help you solve your issue. RE: Inserting special characters into the database - mktek - 05-25-2021 Thank you for answering. I created a form where users write messages. Special characters such as a smile are written in this form field with the mobile phone. Unfortunately, while these special characters are being written to the database, they are being disabled. I am using utf8mb4 as the database character set. There is no problem with the database. The problem is that the db-builder neutralizes these characters. I'm writing sample code. You can try by typing special characters such as smile with your mobile phone where it says ****. Please see the picture. (Sorry about my bad English.) PHP Code: //$mesaj_post = trim($this->request->getVar('mesaj_post')); RE: Inserting special characters into the database - php_rocs - 05-25-2021 @mktek, What version of CI are you using? Is it up to date? Have you tried using query binding (https://codeigniter.com/userguide3/database/queries.html?highlight=binding#query-bindings) to see if that works better for you. RE: Inserting special characters into the database - InsiteFX - 05-25-2021 Make sure your using character set utf8 and collation utf8_unicode_ci for the database. RE: Inserting special characters into the database - mktek - 05-25-2021 Finally I found the cause of the problem. I made the necessary arrangements in the database. I used utf8mb4 as a character set. Database change was not enough. The following changes were required in the Config / Database.php file: PHP Code: //Old value: Thanks @InsiteFX, @php_rocs RE: Inserting special characters into the database - php_rocs - 05-26-2021 @mktek, Your welcome. I'm glad that I could assist. RE: Inserting special characters into the database - InsiteFX - 05-26-2021 @mktek, Glad that you got it solved. |