Move the email table updates to the PHP file, we need to fetch data, convert db, then update data

This commit is contained in:
james 2009-12-03 19:52:59 +00:00
parent cb9e783071
commit e51b7fc1b2
2 changed files with 6 additions and 3 deletions

View File

@ -1,7 +1,13 @@
<?
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))."' ,

View File

@ -1,6 +1,3 @@
ALTER TABLE `emails` CHANGE `body` `body` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
ALTER TABLE `emails` CHANGE `bodyhtml` `bodyhtml` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
ALTER TABLE `emails` CHANGE `subject` `subject` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
ALTER TABLE `emailqueue` CHANGE `body` `body` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
ALTER TABLE `emailqueue` CHANGE `bodyhtml` `bodyhtml` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
ALTER TABLE `emailqueue` CHANGE `subject` `subject` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;