I want to insert a value in a table . But when I am running below code , I see that shows this value with ????
. How can I solve this problem ?
insert.php
<?php
include "connect.php";
$query = "INSERT INTO customer_tab (name,phone,address) VALUE ('آزاده','0981245','ایران کرمان')";
$result = $connect->prepare($query);
$result->execute();
?>
connect.php
<?php
$server = "localhost";
$user = "azadgh";
$pass = "*******";
$dbname = "my_db";
$dsn = "mysql:host=localhost;dbname=$dbname";
try {
$connect = new PDO($dsn, $user, $pass);
$connect->exec("SET character_set_connection = 'UTF8");
$connect->exec("SET NAMES 'UTF8");
$connect->exec("SET CHARACTER SET 'utf8'");
} catch (PDOException $error) {
echo "unable to connect : " . $error->getMessage();
}
?>
Thanks in advance for any help.