science-ation/db/db.update.155.php

21 lines
891 B
PHP
Raw Normal View History

<?
2009-12-03 19:43:18 +00:00
function db_update_155_post() {
//we need to query the stuff from the table
$q=mysql_query("SELECT * FROM emails");
//make the changes to the database
mysql_query("ALTER TABLE `emails` CHANGE `body` `body` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL");
mysql_query("ALTER TABLE `emails` CHANGE `bodyhtml` `bodyhtml` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL");
mysql_query("ALTER TABLE `emails` CHANGE `subject` `subject` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL");
//then update the data
while($r=mysql_fetch_object($q)) {
mysql_query("UPDATE emails SET
body='".mysql_real_escape_string(iconv("ISO-8859-1","UTF-8",$r->body))."' ,
bodyhtml='".mysql_real_escape_string(iconv("ISO-8859-1","UTF-8",$r->bodyhtml))."' ,
subject='".mysql_real_escape_string(iconv("ISO-8859-1","UTF-8",$r->subject))."'
WHERE id='$r->id'");
}
}
?>