View Single Post
  #11  
Old 12-20-2004, 04:20 AM
 
zefon zefon is offline
 

Advanced Member
  
Join Date: Apr 2003
Posts: 86
 

Default

Here is the code to "proper case" multiple word fields like the address line in your existing database.

Code:
<? @include_once "./top.inc.php"; if (!defined('DIR_CUSTOMER')) @include_once "../top.inc.php"; if (!defined('DIR_CUSTOMER')) die("ERROR: Cannot find application! Please check the configuration."); include_once $xcart_dir."/config.php"; $field = "%FIELD_HERE%"; $table = "%TABLE_HERE%"; $data = func_query("SELECT $field FROM $table"); foreach ($data as $k) { db_query("UPDATE $table SET $field ='".ucwords($k[$field])."' WHERE $field ='$k[$field]';"); echo "Convert: ".$k[$field]." => ".ucwords($k[$field])." "; } ?>

Create a php file with this code. Repalce %FIELD_HERE% and %TABLE_HERE% strings with name of field you want to modify and name of table where this field is stored.

For example you can replace :

$field = "%FIELD_HERE%";
$table = "%TABLE_HERE%";

with

$field = "b_address";
$table = "xcart_customers";


Then just upload the file and run it. You will get an on-screen look at all the field changes. It takes a minute or to to run so be patient.
__________________
X-Cart Gold 4.1.8
Reply With Quote