1

For instance when I try to insert "Sebastián" into the database, it gets stored as "Sebastián".

This is the test code which I am trying out:

<?php include 'database.php'; ?>

<?php
$name = "Sebastián";

$query = "INSERT INTO students (name) VALUES ('$name')";
$insert_row = $mysqli->query($query) or die($mysqli->error.__LINE__);

if($insert_row){
    echo "Insertion was successful";
}
?>

<!DOCTYPE html>
<html>
<head>
    <title></title>
    <meta charset="utf-8" />
</head>
<body>
</body>
</html>

I am using PhpMyAdmin and the setting of the server connection collation is illustrated in the below screenshot:

enter image description here

rvelbon
  • 91
  • 5
  • 3
    Possible duplicate of [php mysql special character](http://stackoverflow.com/questions/10721867/php-mysql-special-character) – Daniel A. Thompson Nov 19 '16 at 21:52
  • You're using mysqli .. okay, good. Now use placeholders / parameterized queries. See http://stackoverflow.com/questions/60174 – user2864740 Nov 19 '16 at 22:30

0 Answers0