Friends, how are you?
I'm learning about PHP and testing connections to MySQL I noticed a curious problem:
If I am using phpMyAdmin and through it I insert records, with accentuation, in my table the information is normally displayed when performing a SELECT. However, when displaying this data in my PHP project they do not display the accents and instead have those characters already well known in this situation.
On the other hand, if I insert the data through my PHP project the display usually occurs with the accents, but by pulling the SELECT within phpMyAdmin the record returns with error in coding these accents.
Notice that in both cases I can view the information with the accented characters and on the same screen there will be records with corrupted characters, either in my PHP project or through the phpMyAdmin interface, having as their differential the interface by which the record has been entered.
When I created the database I used the following script:
CREATE DATABASE nome_banco
DEFAULT CHARACTER SET utf8
DEFAULT COLLATE utf8_general_ci;
For the tables I used the following script:
CREATE TABLE nome_tabela (
...
) DEFAULT CHARSET = utf8;
And in my PHP project, I use a template file that takes in HTML:
<!DOCTYPE html>
<html lang="pt-BR">
<head>
<meta charset="UTF-8" />
Does anyone have any tips on what might be happening?