Last active
January 18, 2019 01:31
-
-
Save steveosoule/291959634ce3655eeea636e21efe8396 to your computer and use it in GitHub Desktop.
Replace Broken/Invalid Characters (Latin ISO-8859-1 to UTF-8 charset)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Load Posts | |
$query = $dbh->query("SELECT * FROM `Posts`"); | |
$posts = $query->fetchAll(); | |
// Update Posts | |
foreach($posts as $post) | |
{ | |
$query = $dbh->prepare("UPDATE `Posts` SET content = :content WHERE id = :id"); | |
$query->bindParam(':content', utf8_encode($post['content'])); | |
$query->bindParam(':id', $post['id']); | |
$query->execute($params); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment