Re: Problems with implode

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

 



Maybe you can reduce your code a little using the range();

<?php
$list = range(12300, 12801);
$pidList = implode(',', $list);
mail('your@xxxxxxxxx, 'debug implode', var_export(array($pidList,
$list),1));
?>

it's just a sugestion...

Regards,
Igor Escobar
systems analyst & interface designer
www . igorescobar . com



On Wed, Mar 25, 2009 at 4:42 AM, Toke Herkild <th@xxxxxxxxxxx> wrote:

> Okay, tested in the following manner:
>
> for ($i=12300;$i<12801;$i++){
>  // List is filled with integers, in the correct charset from PHP
>  $list[] = $i;
> }
> $pidList = implode(',', $list);
> mail('your@xxxxxxxxx, 'debug implode', var_export(array($pidList,
> $list),1));
>
> And I got the same error, which indicates that perhaps implode works just
> as it should but the representation is off. that in it self would be okay,
> but how then do we control that the query is actually correct ?
> If we cannot trust the debug output how then can we trust that the query
>  is doing what it is supposed to do ?
>
> Regards,
> Toke
>
> Toke Herkild skrev:
>
>  As stated before, packet size not the problem, data is delivered perfectly
>> from MySQL.
>> Problem seems to be when the result string is diplayed.
>> I'll try to do a test with a numeric array:
>> $list = array(12300..12800); and see what happens.
>>
>> regards,
>> Toke
>>
>> Andrea Giammarchi skrev:
>>
>>> What about MySQL max_allowed_packet setting? is it bigger than produced
>>> string?
>>>
>>>  To: php-general@xxxxxxxxxxxxx
>>>> Date: Tue, 24 Mar 2009 15:23:20 +0100
>>>> From: th@xxxxxxxxxxx
>>>> Subject: Re:  Problems with implode
>>>>
>>>> Per Jessen skrev:
>>>>
>>>>> Andrea Giammarchi wrote:
>>>>>
>>>>>  Dunno why you guys started talk about utf-8 problems, he has a list of
>>>>>> ids which should contain only unsigned integers, otherwise I do not
>>>>>> get how that query could work with an implode(',', $whatever)
>>>>>>
>>>>> Very good point - maybe the OP has not yet tested his code that far?
>>>>>  Is
>>>>> there a possibility that some of the id's are _not_ just plain integers
>>>>> made up of 0-9?
>>>>>
>>>>> /Per
>>>>>
>>>>>  And exatly the reason I tried the following:
>>>> $list[] = $row['uid'];
>>>> $list[] = intval($row['uid']);
>>>> $list[] = mb_convert_encoding($row['uid'], 'iso-8859-1');
>>>> $list[] = mb_convert_encoding(intval($row['uid']), 'iso-8859-1');
>>>>
>>>> My best bet as for now:
>>>> It isn't implode there's the problem, but the length of the string
>>>>
>>>> --
>>>> PHP General Mailing List (http://www.php.net/)
>>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>>
>>>>
>>> _________________________________________________________________
>>> More than messages–check out the rest of the Windows Live™.
>>> http://www.microsoft.com/windows/windowslive/
>>>
>>
>  As stated before, packet size not the problem, data is delivered perfectly
>> from MySQL.
>> Problem seems to be when the result string is diplayed.
>> I'll try to do a test with a numeric array:
>> $list = array(12300..12800); and see what happens.
>>
>> regards,
>> Toke
>>
>> Andrea Giammarchi skrev:
>>
>>> What about MySQL max_allowed_packet setting? is it bigger than produced
>>> string?
>>>
>>>  To: php-general@xxxxxxxxxxxxx
>>>> Date: Tue, 24 Mar 2009 15:23:20 +0100
>>>> From: th@xxxxxxxxxxx
>>>> Subject: Re:  Problems with implode
>>>>
>>>> Per Jessen skrev:
>>>>
>>>>> Andrea Giammarchi wrote:
>>>>>
>>>>>  Dunno why you guys started talk about utf-8 problems, he has a list of
>>>>>> ids which should contain only unsigned integers, otherwise I do not
>>>>>> get how that query could work with an implode(',', $whatever)
>>>>>>
>>>>> Very good point - maybe the OP has not yet tested his code that far?
>>>>>  Is
>>>>> there a possibility that some of the id's are _not_ just plain integers
>>>>> made up of 0-9?
>>>>>
>>>>> /Per
>>>>>
>>>>>  And exatly the reason I tried the following:
>>>> $list[] = $row['uid'];
>>>> $list[] = intval($row['uid']);
>>>> $list[] = mb_convert_encoding($row['uid'], 'iso-8859-1');
>>>> $list[] = mb_convert_encoding(intval($row['uid']), 'iso-8859-1');
>>>>
>>>> My best bet as for now:
>>>> It isn't implode there's the problem, but the length of the string
>>>>
>>>> --
>>>> PHP General Mailing List (http://www.php.net/)
>>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>>
>>>>
>>> _________________________________________________________________
>>> More than messages–check out the rest of the Windows Live™.
>>> http://www.microsoft.com/windows/windowslive/
>>>
>>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

[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