Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function setProperCollation($character, $collation)
- {
- $tables = $this->getAllTables();
- for ($i = 0; $i < count($tables); $i++)
- {
- try
- {
- $newSettings = $this->conn->prepare('ALTER TABLE ? CONVERT TO CHARACTER SET ? COLLATE ?');
- $newSettings->bindParam(1, $tables[$i][0], PDO::PARAM_STR);
- $newSettings->bindParam(2, $character, PDO::PARAM_STR);
- $newSettings->bindParam(3, $collation, PDO::PARAM_STR);
- $newSettings->execute();
- } catch (PDOException $e)
- {
- echo "Error: " . $e->getMessage() . "<br>";
- die();
- }
- }
- echo "Done";
- }
- // Error: SQLSTATE[42000]: Syntax error or access violation: 1064 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
- // '? CONVERT TO CHARACTER SET ? COLLATE ?' at line 1
Advertisement
Add Comment
Please, Sign In to add comment