I have this piece of code below and it's working fine, the issues is that when it goes up if I use bulgarian characters everything comes out like Страната на чудеÑатÐ
But when I add bulgarian stuff from the admin menu (Opencart) display in Bulgarian.
The Database table 'name'
is in utf8_general_ci.
<?php
include 'config.php';
$servername = DB_HOSTNAME;
$username = DB_USERNAME;
$password = DB_PASSWORD;
$dbname = DB_DATABASE;
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "UPDATE product_description SET name = REPLACE(name, 'The amazing spiderman Phone', 'Страната на чудесата')";
if ($conn->query($sql) === TRUE) {
echo "Record updated successfully";
} else {
echo "Error updating record: " . $conn->error;
}
$conn->close();
?>