can i update table and set JSON string with PDO? Because PDO is removing "\" character and diacritics is not working please help.
->query("UPDATE products SET name = '".$new_name."' WHERE shop = '1' AND id = 'a9t8'");
can i update table and set JSON string with PDO? Because PDO is removing "\" character and diacritics is not working please help.
->query("UPDATE products SET name = '".$new_name."' WHERE shop = '1' AND id = 'a9t8'");
You are using PDO
yet still open to SQL
injection.
You should prepare
your query, that's the whole point of PDO
$sql = "UPDATE products SET name = :new_name WHERE shop = :shop AND id = :id";
$statement = $conn->prepare($sql);
$statement->bindValue(":new_name", $new_name);
$statement->bindValue(":shop", '1');
$statement->bindValue(":id", 'a9t8');
$statement->execute();