problem with slash / characters

problem with slash / characters

am 01.10.2008 21:02:37 von Tanner Postert

------=_Part_114107_9717664.1222887757432
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

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.

------=_Part_114107_9717664.1222887757432--

Re: problem with slash / characters

am 01.10.2008 21:16:23 von Al

Tanner Postert wrote:
> 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.
>

What happens if you change the "/" to another character, e.g., "#"?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: Re: problem with slash / characters

am 01.10.2008 21:18:51 von Tanner Postert

------=_Part_114592_20407385.1222888731879
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

very, strange.

if I change it to c / o Company XYZ ( with spaces between each character) it
becomes: c 1 o Company XYZ.
if I change it to c#o Company XYZ it becomes c1o Company XYZ

On Wed, Oct 1, 2008 at 12:16 PM, Al wrote:

>
>
> Tanner Postert wrote:
>
>> 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.
>>
>>
> What happens if you change the "/" to another character, e.g., "#"?
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

------=_Part_114592_20407385.1222888731879--

Re: problem with slash / characters

am 01.10.2008 21:22:35 von Ashley Sheridan

On Wed, 2008-10-01 at 12:02 -0700, Tanner Postert wrote:
> 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.
So you're saying it changes for some values returned from the database
and not others? Is there anything particularly different about the ones
that are being returned? Are you sure that the database has the correct
values?


Ash
www.ashleysheridan.co.uk


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: Re: problem with slash / characters

am 01.10.2008 21:24:33 von Tanner Postert

------=_Part_114783_27712506.1222889073175
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

just did some further testing, and even if I remove the special characters,
the 3rd character in that string becomes a 1.

I change it to Company XYZ,
and it looks right when its assigned to the array the first time, and on the
next iteration of the loop. but after that, it looks lke Co1pany XYZ.

On Wed, Oct 1, 2008 at 12:18 PM, Tanner Postert wrote:

> very, strange.
>
> if I change it to c / o Company XYZ ( with spaces between each character)
> it becomes: c 1 o Company XYZ.
> if I change it to c#o Company XYZ it becomes c1o Company XYZ
>
>
> On Wed, Oct 1, 2008 at 12:16 PM, Al wrote:
>
>>
>>
>> Tanner Postert wrote:
>>
>>> 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.
>>>
>>>
>> What happens if you change the "/" to another character, e.g., "#"?
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>

------=_Part_114783_27712506.1222889073175--

Re: Re: problem with slash / characters

am 01.10.2008 21:29:39 von Tanner Postert

------=_Part_114940_1684513.1222889379950
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

figured it out.

later on in the code theres some formatting for a specific values that the
address_2 field was accidentally falling into.

On Wed, Oct 1, 2008 at 12:24 PM, Tanner Postert wrote:

> just did some further testing, and even if I remove the special characters,
> the 3rd character in that string becomes a 1.
>
> I change it to Company XYZ,
> and it looks right when its assigned to the array the first time, and on
> the next iteration of the loop. but after that, it looks lke Co1pany XYZ.
>
> On Wed, Oct 1, 2008 at 12:18 PM, Tanner Postert wrote:
>
>> very, strange.
>>
>> if I change it to c / o Company XYZ ( with spaces between each character)
>> it becomes: c 1 o Company XYZ.
>> if I change it to c#o Company XYZ it becomes c1o Company XYZ
>>
>>
>> On Wed, Oct 1, 2008 at 12:16 PM, Al wrote:
>>
>>>
>>>
>>> Tanner Postert wrote:
>>>
>>>> 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.
>>>>
>>>>
>>> What happens if you change the "/" to another character, e.g., "#"?
>>>
>>> --
>>> PHP General Mailing List (http://www.php.net/)
>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>
>>>
>>
>

------=_Part_114940_1684513.1222889379950--