seat stress problem

Asked

Viewed 55 times

0

Friends, I’m having trouble recording accentuated in the database as soon as I changed the version to PHP 5.6

I know you have several questions on this subject, but I’ve tested several of them and it doesn’t work at all, restore the entire database, tables, everything from scratch and it doesn’t work.

I am using UTF8. Any recommendation to solve the problem?

Att

  • You are using PDO ?

  • huahuaua, if you can tell me how it was because until hj I could not migrate to version 7 because of this and I think I should start from scratch, bank, table etc...

2 answers

1

You must configure the encoding in PHP, just insert this line:

ini_set('default_charset', 'utf-8');

Also, at the time you make the connection to the database, example using the PDO:

$pdocon->exec("set names utf8");

To MSQLI:

$con = mysqli_connect($DB_SERVER, $DB_USER_READER, $DB_PASS_READER, $DB_NAME, $DB_PORT);

mysqli_set_charset($con, 'utf8');

0

I have tried ini_set('default_charset', 'utf-8'); and nothing.

I also tried it this way and it didn’t work.

mysqli_query($connected, "SET NAMES 'utf8'"); mysqli_query($connection, 'SET character_set_connection=utf8'); mysqli_query($connection, 'SET character_set_client=utf8'); mysqli_query($connection, 'SET character_set_results=utf8');

The problem is only when you write to the BD, to display in the browser the accent loads normal.

When using version 5.4 did not have this problem, it was only migrate that the nightmare began.

  • I edited my answer, try it that way. Then delete this answer here that I’m commenting on.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.