problem with slash / characters

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



ignore previous. sorry.

I'm trying to display values from a database, the values come from the
database like this:

[0] => Array
(
   [id] => 5
   [order_id] => 10
   [key] => ship_to_name
   [value] => John Anderson
)
[1] => Array
(
   [id] => 6
   [order_id] => 10
   [key] => ship_to_address
   [value] => c/o Company XYZ
)

etc.

so i am rolling thru that array and making a new array by:

foreach ( $data as $k = $v ) {
 $new[$v['key']] = $v['value'];
}
so that i have 1 array.

The problem is that somewhere along the way the string "c/o Company XYZ" is
becoming c/1 Company XYZ.

I added a print_r after every iteration to see what its looking like along
the way:

foreach( $data as $k=>$v ) {
  error_log( "new" . $v['key'] . " = " . $v['value'] );
  $new[$v['key']] = $v['value'];
  error_log( print_r( $new, true ) );
}

and I get:

new ship_to_name = Gordon Anderson
Array
(
    [ship_to_name] => Gordon Anderson
)
new ship_to_address = c/o Company XYZ
Array
(
    [ship_to_name] => Gordon Anderson
    [ship_to_address] => c/o Company XYZ
)
new ship_to_address_2 = 1100 S Baldwin
Array
(
    [ship_to_name] => Gordon Anderson
    [ship_to_address] => c/o Company XYZ
    [ship_to_address_2] => 1100 S Baldwin
)
new ship_to_city = Oxford
Array
(
    [ship_to_name] => Gordon Anderson
    [ship_to_address] => c/1 Company XYZ
    [ship_to_address_2] => 1100 S Baldwin
    [ship_to_city] => Oxford
)
... and it looks the same for the remaining iterations.


how did the string change in the middle of that for loop?

This also only happens on one machine. the production environment, which his
Redhat, it doesn't happen on my development env, which is Fedora 9.

Thanks in advance.

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux