How to change values of global variables in the free account?

epiz_32632858

My data is getting wrong accentuation in mysql database, because I can’t change the global variables to encoding “utf8mb4” and “utf8mb4_general_ci”

PHPMyAdmin sometimes has issues with encoding. Try using PHP to sent the data to the database, and make sure to define the charset in your query.

If that does not work, please share the SQL query.

Thanks

4 Likes

Global values means they are for the entire server. So that’s not just your account, but all other accounts on the server too. So we can’t let you edit global variables, because the options your site may need can break the sites of others.

But you can set the charset through your own code. Both MySQLi and PDO support specifying your own charset. If you set that charset to utf8mb4 in your code, you’ll always have the correct charset in the database, regardless of where you’re hosting your code.

https://www.php.net/manual/en/mysqlinfo.concepts.charset.php

And the collation and charsets of your tables and columns can be set yourself, through phpMyAdmin or whatever tool you’re using to setup the database schema.

3 Likes

My site is all configured in UTF-8.

I’m sending the data all in UTF-8 and I created the table defining the data as UTF-8, but the database receives the data all deformed.

I developed the whole system on a local server and I didn’t get any problems, but when I put it on infinity the data gets messed up.

Your site is, but…

You did not do this. I checked your database connection code and you’re not setting the connection charset, which means data is sent to the database with latin1 encoding.

Seeing how you’re using MySQLi, you need to use this function to set the connection charset:

https://www.php.net/manual/en/mysqli.set-charset

Once you do this, then any data submitted afterwards will have the right encoding.

4 Likes

Great, it all worked out! It wasn’t really handling the charset on the connection. Thank you very much!!!

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.