The Exchange Project Preview Release 2.2 Database Update Script

This script removes all hardcode occurences of 'images/' in the following tables:

categories.categories_image
manufacturers.manufacturers_image
products.products_image

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!'); // categories $categories_query = tep_db_query("select categories_id, categories_image from categories where left(categories_image, 7) = 'images/'"); while ($categories = tep_db_fetch_array($categories_query)) { tep_db_query("update categories set categories_image = substring('" . $categories['categories_image'] . "', 8) where categories_id = '" . $categories['categories_id'] . "'"); } // manufacturers $manufacturers_query = tep_db_query("select manufacturers_id, manufacturers_image from manufacturers where left(manufacturers_image, 7) = 'images/'"); while ($manufacturers = tep_db_fetch_array($manufacturers_query)) { tep_db_query("update manufacturers set manufacturers_image = substring('" . $manufacturers['manufacturers_image'] . "', 8) where manufacturers_id = '" . $manufacturers['manufacturers_id'] . "'"); } // products $products_query = tep_db_query("select products_id, products_image from products where left(products_image, 7) = 'images/'"); while ($products = tep_db_fetch_array($products_query)) { tep_db_query("update products set products_image = substring('" . $products['products_image'] . "', 8) where products_id = '" . $products['products_id'] . "'"); } ?> Done!