osCommerce Preview Release 2.2 Database Update Script

This script moves the order comments from the orders table to order_status_history table

Database Server Information
Server: (eg, 192.168.0.1)
Username: (eg, root)
Password: (eg, bee)
Database: (eg, catalog)
 
' . $errno . ' - ' . $error . '

' . $query . '

[TEP STOP]

'); } function tep_db_query($db_query) { global $db_link; $result = mysql_query($db_query, $db_link) or tep_db_error($db_query, mysql_errno(), mysql_error()); return $result; } function tep_db_fetch_array($db_query) { $result = mysql_fetch_array($db_query); return $result; } tep_db_connect() or die('Unable to connect to database server!'); tep_db_query("ALTER TABLE orders_status_history DROP old_value"); tep_db_query("ALTER TABLE orders_status_history ADD comments TEXT"); tep_db_query("ALTER TABLE orders_status_history CHANGE new_value orders_status_id INT(5) DEFAULT '0' NOT NULL"); $orders_query = tep_db_query("select orders_id, date_purchased, comments from orders where comments <> ''"); while ($order = tep_db_fetch_array($orders_query)) { tep_db_query("insert into orders_status_history (orders_id, orders_status_id, date_added, comments) values ('" . $order['orders_id'] . "', '1', '" . $order['date_purchased'] . "', '" . addslashes($order['comments']) . "')"); } tep_db_query("alter table orders drop comments"); ?> Done!