I'm trying to develop a PHP script to insert Arabic language in mysql db, but the issue when I insert the data thru PHP code I got a unknown language, as show below.
Snapshot of unknown language:
as I'm using the below PHP script to insert the data .
<html>
<head>
<title>Insert test</title>
<form action="insert_data_script.php" method="post">
<input type="text" name="text" value="name">
<input type="submit" value="submit">
</form>
</head>
</html>
as the insert_data_script.php will include the below ;
<?php
$servername = "localhost";
$username = "abrazaqc_cyclist";
$password = "xxxxxx";
$conn = mysqli_connect($servername, $username, $password);
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
$sql ="INSERT INTO `abrazaqc_test`.`insert` (
`idinsert` ,
`info`
)
VALUES (
NULL , '" . $_POST["text"] ."'
)";
if (mysqli_query($conn, $sql)) {
echo "New record created successfully";
} else {
echo "Error: " . $sql . "<br>" . mysqli_error($conn);
}
mysqli_close($conn);
?>
Notes: snapshot from table:
- I have tried everything, but I can't solve the issue .
- I hope someone can help me to solve the issue .