I'm trying to update the content of a database (specifically the post content of one of the posts database's records).
So here's my PHP code :
$update_sql = "UPDATE wp_posts SET post_content='$new_content' WHERE ID=602";
if (mysqli_query($conn, $update_sql)) {
echo "Record updated successfully";
} else {
echo "Error updating record: " . mysqli_error($conn);
}
This is what I get:
Error updating record: You have an error in your SQL syntax;
check the manual that corresponds to your MySQL server
version for the right syntax to use near 'attention�sur
les plats eux-m�mes, le service est lui aussi tout en
simplicit' at line 1
I don't know what I'm doing wrong. All I know is that $new_content contains a very long string (an entire wordpress post's content, complete with various HTML tags).
What should I do for it to accept my update query ?
Thanks for your help
post_contentcolumn?