Re: [PHP] Problems with implode

2009-03-26 Thread Toke Herkild

Tom Worster skrev:

On 3/24/09 9:25 AM, Andrea Giammarchi an_...@hotmail.com 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) rather than 'id in
('.implode(',', array_map('mysql_real_escape_string', $whatever)).')' ...
so, the problem could be more about missed ids in the array obtaining ,, ...
so, in this case, array_filter before, no?


it's certainly possible. but the way toke described his problem did not
imply that his ids were unsigned integers.

SELECT FROM ... WHERE id IN ('aardvark', 'abacus', 'abbey', ..., 'zulu',
'zygote');





AS written else it is not a problem with either implode nor with string,
Only when sending debug info via unformatted mail.
Which really should not give this problem, but it does one day I'll have 
time to figure out exactly what does trigger this error.


Regards,
Toke

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



Re: [PHP] Problems with implode

2009-03-26 Thread Virgilio Quilario
 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) rather than 'id in
 ('.implode(',', array_map('mysql_real_escape_string', $whatever)).')'
 ...
 so, the problem could be more about missed ids in the array obtaining ,,
 ...
 so, in this case, array_filter before, no?

 it's certainly possible. but the way toke described his problem did not
 imply that his ids were unsigned integers.

 SELECT FROM ... WHERE id IN ('aardvark', 'abacus', 'abbey', ..., 'zulu',
 'zygote');




 AS written else it is not a problem with either implode nor with string,
 Only when sending debug info via unformatted mail.
 Which really should not give this problem, but it does one day I'll have
 time to figure out exactly what does trigger this error.

 Regards,
 Toke


it is probably the way the email message was formatted.
it has to cut long lines to email line length limit.
so you see some numbers are broken ie on different lines.

Virgil
http://www.jampmark.com

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



RE: [PHP] Problems with implode

2009-03-26 Thread Andrea Giammarchi

The mail problem came out later or I missed some post about it.
So yes, I would pass that implode via wordwrap then

wordwrap(implode(', ', $list), 100, \n, false);

please note the space after the coma, to avoid truncated id.

@Tom Worster
I hope on daily basis you do NOT create arrays with single or double quoted 
strings when you need to implode an array of strings ... as I wrote already, if 
those where not numbers, that implode did not make sense:
'WHERE id IN ('.implode(',', array_map('mysql_real_escape_string', 
$whatever)).')'Regards



 Date: Thu, 26 Mar 2009 21:01:03 +0800
 From: virgilio.quila...@gmail.com
 To: t...@ezl-data.dk
 CC: php-general@lists.php.net
 Subject: Re: [PHP] Problems with implode
 
  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) rather than 'id in
  ('.implode(',', array_map('mysql_real_escape_string', $whatever)).')'
  ...
  so, the problem could be more about missed ids in the array obtaining ,,
  ...
  so, in this case, array_filter before, no?
 
  it's certainly possible. but the way toke described his problem did not
  imply that his ids were unsigned integers.
 
  SELECT FROM ... WHERE id IN ('aardvark', 'abacus', 'abbey', ..., 'zulu',
  'zygote');
 
 
 
 
  AS written else it is not a problem with either implode nor with string,
  Only when sending debug info via unformatted mail.
  Which really should not give this problem, but it does one day I'll have
  time to figure out exactly what does trigger this error.
 
  Regards,
  Toke
 
 
 it is probably the way the email message was formatted.
 it has to cut long lines to email line length limit.
 so you see some numbers are broken ie on different lines.
 
 Virgil
 http://www.jampmark.com
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

_
News, entertainment and everything you care about at Live.com. Get it now!
http://www.live.com/getstarted.aspx

Re: [PHP] Problems with implode

2009-03-25 Thread Toke Herkild
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@lists.php.net
Date: Tue, 24 Mar 2009 15:23:20 +0100
From: t...@ezl-data.dk
Subject: Re: [PHP] 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



Re: [PHP] Problems with implode

2009-03-25 Thread Toke Herkild

Okay, tested in the following manner:

for ($i=12300;$i12801;$i++){
  // List is filled with integers, in the correct charset from PHP
  $list[] = $i;
}
$pidList = implode(',', $list);
mail('y...@email.dom, '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@lists.php.net
Date: Tue, 24 Mar 2009 15:23:20 +0100
From: t...@ezl-data.dk
Subject: Re: [PHP] 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@lists.php.net
Date: Tue, 24 Mar 2009 15:23:20 +0100
From: t...@ezl-data.dk
Subject: Re: [PHP] 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



Re: [PHP] Problems with implode

2009-03-25 Thread Toke Herkild

works fine, created a html output to browser which displayed nicely.
- weird

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@lists.php.net
Date: Tue, 24 Mar 2009 15:23:20 +0100
From: t...@ezl-data.dk
Subject: Re: [PHP] 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



Re: [PHP] Problems with implode

2009-03-25 Thread Igor Escobar
Maybe you can reduce your code a little using the range();

?php
$list = range(12300, 12801);
$pidList = implode(',', $list);
mail('y...@email.dom, '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 t...@ezl-data.dk wrote:

 Okay, tested in the following manner:

 for ($i=12300;$i12801;$i++){
  // List is filled with integers, in the correct charset from PHP
  $list[] = $i;
 }
 $pidList = implode(',', $list);
 mail('y...@email.dom, '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@lists.php.net
 Date: Tue, 24 Mar 2009 15:23:20 +0100
 From: t...@ezl-data.dk
 Subject: Re: [PHP] 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@lists.php.net
 Date: Tue, 24 Mar 2009 15:23:20 +0100
 From: t...@ezl-data.dk
 Subject: Re: [PHP] 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




Re: [PHP] Problems with implode

2009-03-25 Thread Tom Worster
On 3/24/09 9:25 AM, Andrea Giammarchi an_...@hotmail.com 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) rather than 'id in
 ('.implode(',', array_map('mysql_real_escape_string', $whatever)).')' ...
 so, the problem could be more about missed ids in the array obtaining ,, ...
 so, in this case, array_filter before, no?

it's certainly possible. but the way toke described his problem did not
imply that his ids were unsigned integers.

SELECT FROM ... WHERE id IN ('aardvark', 'abacus', 'abbey', ..., 'zulu',
'zygote');




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



[PHP] Problems with implode

2009-03-24 Thread Toke Herkild

Hi All,

I've an array() with approx 1200 items (list of id-mappings) that part 
works fine.


Now I want to add this list to a query:
$where = id in (.$idList.);

To accomplish that i do an implode:
$idList = implode(',', $TidList);

My problem is that some of the values gets concenated, others ere 
missing 2 or 3 cifres and some just doesn't show up.


Is this some kind of implode feature or a string to large problem ?

Regards,
Toke Herkild

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



Re: [PHP] Problems with implode

2009-03-24 Thread Tom Worster
On 3/24/09 7:14 AM, Toke Herkild t...@ezl-data.dk wrote:

 I've an array() with approx 1200 items (list of id-mappings) that part
 works fine.
 
 Now I want to add this list to a query:
 $where = id in (.$idList.);
 
 To accomplish that i do an implode:
 $idList = implode(',', $TidList);
 
 My problem is that some of the values gets concenated, others ere
 missing 2 or 3 cifres and some just doesn't show up.

my research turned up no conclusive answer to whether implode() is
mbstring-safe. hence i consider it suspect.

so you could profit by investigating if the problem is associated with the
size of the array or with specific data its members. if implode() is not
mbstring-safe (as i suspect) and your data is not all composed of 7-bit
ascii and you use utf-8 strings in the array members then you may be
experiencing a feature of php. if so, then you should be able to demonstrate
the same feature with a much smaller array.

please let us know what you discover.

c u
fsb



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



Re: [PHP] Problems with implode

2009-03-24 Thread Per Jessen
Toke Herkild wrote:

 Hi All,
 
 I've an array() with approx 1200 items (list of id-mappings) that part
 works fine.
 
 Now I want to add this list to a query:
 $where = id in (.$idList.);
 
 To accomplish that i do an implode:
 $idList = implode(',', $TidList);
 
 My problem is that some of the values gets concenated, others ere
 missing 2 or 3 cifres and some just doesn't show up.

I can't reproduce that behaviour - I tried with ascii ('klop') and utf8
('Köhler') text. 


/Per


-- 
Per Jessen, Zürich (3.4°C)


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



Re: [PHP] Problems with implode

2009-03-24 Thread TG
I don't think that would be a problem, the size of the array.  I've used 
implode at least once or twice on fairly large arrays.  More likely is 
something weird with your data.   I'd do a print_r or var_dump to check 
the data and make sure that's not the issue.

Not saying implode isn't having a problem, but I've never seen any issues 
with it like you're describing.

-TG

- Original Message -
From: Toke Herkild t...@ezl-data.dk
To: php-general@lists.php.net
Date: Tue, 24 Mar 2009 12:14:01 +0100
Subject: [PHP] Problems with implode

 Hi All,
 
 I've an array() with approx 1200 items (list of id-mappings) that part 
 works fine.
 
 Now I want to add this list to a query:
 $where = id in (.$idList.);
 
 To accomplish that i do an implode:
 $idList = implode(',', $TidList);
 
 My problem is that some of the values gets concenated, others ere 
 missing 2 or 3 cifres and some just doesn't show up.
 
 Is this some kind of implode feature or a string to large problem ?
 
 Regards,
 Toke Herkild


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



Re: [PHP] Problems with implode

2009-03-24 Thread Per Jessen
TG wrote:

 I don't think that would be a problem, the size of the array.  I've
 used implode at least once or twice on fairly large arrays.  More
 likely is something weird with your data. 

Yeah, like the odd backspace or carriage return perhaps. 


/Per

-- 
Per Jessen, Zürich (3.0°C)


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



Re: [PHP] Problems with implode

2009-03-24 Thread Matt Neimeyer
On Tue, Mar 24, 2009 at 9:15 AM, Per Jessen p...@computer.org wrote:
 TG wrote:

 I don't think that would be a problem, the size of the array.  I've
 used implode at least once or twice on fairly large arrays.  More
 likely is something weird with your data.

 Yeah, like the odd backspace or carriage return perhaps.

I can't tell you how many times I've had data that contained  and got
all kinds of screwed up when data disapeared when really the browser
was just turning it into an HTML tag.

Matt

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



Re: [PHP] Problems with implode

2009-03-24 Thread Tom Worster
On 3/24/09 8:58 AM, Per Jessen p...@computer.org wrote:


 I can't reproduce that behaviour - I tried with ascii ('klop') and utf8
 ('Köhler') text. 

neither can i. if the mail systems don't screw it up, here's my test
strings:

$strs = array(
'Iñtërnâtiônàlizætiøn',
'החמאס: רוצים להשלים את עסקת שליט במהירות האפשרית',
'ايران لا ترى تغييرا في الموقف الأمريكي',
'独・米で死傷者を出した銃の乱射事件',
'國會預算處公布驚人的赤字數據後',
'이며 세계 경제 회복에 걸림돌이 되고 있다',
'В дагестанском лесном массиве южнее села Какашура',
'นายประสิทธิ์ รุ่งสะอาด ปลัดเทศบาล รักษาการแทนนายกเทศมนตรี
ต.ท่าทองใหม่',
'ભારતીય ટીમનો સુવર્ણ યુગ : કિવીઝમાં પણ કમાલ',
'ཁམས་དཀར་མཛེས་ས་ཁུལ་དུ་རྒྱ་གཞུང་ལ་ཞི་བའི་ངོ་རྒོལ་',
'Χιόνια, βροχές και θυελλώδεις άνεμοι συνθέτουν το',
'Հայաստանում սկսվել է դատական համակարգի ձեւավորումը',
'რუსეთი ასევე გეგმავს სამხედრო');

i created an array with 1000 repetitions of this array and imploded and
exploded it successfully.



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



RE: [PHP] Problems with implode

2009-03-24 Thread Andrea Giammarchi

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) rather than 'id in 
('.implode(',', array_map('mysql_real_escape_string', $whatever)).')' ... 
so, the problem could be more about missed ids in the array obtaining ,, ... 
so, in this case, array_filter before, no?

Regards

 Date: Tue, 24 Mar 2009 09:19:53 -0400
 From: m...@neimeyer.org
 To: php-general@lists.php.net
 Subject: Re: [PHP] Problems with implode
 
 On Tue, Mar 24, 2009 at 9:15 AM, Per Jessen p...@computer.org wrote:
  TG wrote:
 
  I don't think that would be a problem, the size of the array.  I've
  used implode at least once or twice on fairly large arrays.  More
  likely is something weird with your data.
 
  Yeah, like the odd backspace or carriage return perhaps.
 
 I can't tell you how many times I've had data that contained  and got
 all kinds of screwed up when data disapeared when really the browser
 was just turning it into an HTML tag.
 
 Matt
 
 -- 
 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/

Re: [PHP] Problems with implode

2009-03-24 Thread Jan G.B.
2009/3/24 Toke Herkild t...@ezl-data.dk:
 Hi All,

 I've an array() with approx 1200 items (list of id-mappings) that part works
 fine.

 Now I want to add this list to a query:
 $where = id in (.$idList.);

 To accomplish that i do an implode:
 $idList = implode(',', $TidList);


Are all of the Ids truly numeric?

You could try it that way:

$sql = SELECT * from a where x IN(' . implode(', ', $array) . ')

implode string = ', '

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



Re: [PHP] Problems with implode

2009-03-24 Thread Tom Worster
On 3/24/09 9:15 AM, Per Jessen p...@computer.org wrote:

 TG wrote:
 
 I don't think that would be a problem, the size of the array.  I've
 used implode at least once or twice on fairly large arrays.  More
 likely is something weird with your data.
 
 Yeah, like the odd backspace or carriage return perhaps.

if using utf-8, validate the data with mb_check_encoding() or
preg_match('/^.{1}/us', $s)

for example, could be that the strings in the big array are mixing
encodings.



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



RE: [PHP] Problems with implode

2009-03-24 Thread Per Jessen
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

-- 
Per Jessen, Zürich (4.1°C)


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



Re: [PHP] Problems with implode

2009-03-24 Thread Toke Herkild

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



Re: [PHP] Problems with implode

2009-03-24 Thread Toke Herkild

Tom Worster skrev:

On 3/24/09 9:15 AM, Per Jessen p...@computer.org wrote:


TG wrote:


I don't think that would be a problem, the size of the array.  I've
used implode at least once or twice on fairly large arrays.  More
likely is something weird with your data.

Yeah, like the odd backspace or carriage return perhaps.


if using utf-8, validate the data with mb_check_encoding() or
preg_match('/^.{1}/us', $s)

for example, could be that the strings in the big array are mixing
encodings.




As for the data, it's numbers allright:

array:0 is the imploded string
array:1 is the array to be imploded

array (
  0 = 
'12498,13018,13019,13020,13027,13028,13029,13031,13032,13030,13024,13026,13021,13022,13036,13035,13034,13023,12940,12991,12992,12993,12994,12995,12996,12997,12998,12999,13000,13001,13002,13003,13004,13005,13006,13007,13008,13009,13010,13011,13012,13013,13014,13015,13016,13017,12941,12942,12943,12944,12945,12946,12947,12948,12949,12950,12951,12952,12953,12954,12955,12956,12957,12958,12959,12960,12961,12962,12963,12964,12965,12966,12967,12968,12969,12970,12971,12972,12973,12974,12975,12976,12977,12978,12979,12980,12981,12982,12983,12984,12985,12986,12987,12988,12989,12990,12906,12939,12936,12937,12938,12934,12935,12930,12931,12933,12932,12925,12926,12927,12928,12916,12917,12918,12919,12920,12921,12907,12908,12909,12910,12911,12912,12913,12914,12915,12929,12922,12923,12924,12879,12884,12885,12886,12887,12888,12889,12890,12891,12892,12893,12894,12895,12896,12897,12898,13859,12899,12900,12901,12902,12903,12904,12905,12881,12882,12859,12860,12861,12862,12863,12864,12865,12866,1385

4,12867,12868,12869,12870,12871,12872,12873,12874,12875,12876,12877,12878,12843,12856,12857,12858,12853,12854,12855,12850,12851,12852,12846,12847,12848,12849,12844,12845,12836,12837,12838,12790,13898,12833,12834,12835,12830,12831,12832,12827,12828,12806,12807,12808,12809,12810,12811,12812,12813,12815,12816,12817,12818,12819,12820,12825,12826,12821,12823,12824,12822,12791,12792,12793,12794,12795,12796,12797,12798,12799,12800,12801,12802,12803,12804,12805,12829,12750,12770,12771,12772,12773,12774,12775,12776,12777,12778,12779,12780,12781,12782,12783,12784,12785,12786,12787,12788,12789,12767,12768,12751,12752,12753,12754,12763,12764,12765,12766,12757,12758,12759,12760,12762,12769,12716,12720,12721,12722,12723,12724,12725,12726,12727,12728,12729,12730,12731,12732,13676,12733,12734,12735,12736,12737,12738,12739,12740,12741,12742,12743,12744,12745,12746,12747,12748,12749,12717,12718,12719,12499,13889,13895,13894,13893,13892,13891,13890,13873,13756,13762,13763,13768,13764,13765,1376
6,13755,13757,13758,13767,13759,13760,13761,12500,12501,138
12502,12503,12504,12505,12506,12507,12510,12511,12512,12513,12514,12515,12516,12517,12518,12519,12520,12521,12522,12523,12524,12525,12526,12527,12528,12529,12530,12531,12532,12533,12534,12535,12536,12537,12538,12539,12540,12541,12542,12543,12544,12545,13875,13874,12546,12547,12548,12549,12550,12551,12552,12553,12554,12555,12556,12557,12558,12559,12562,12563,12564,12565,12560,12561,12566,13678,12567,12705,12714,12715,12706,12707,12708,12709,12710,12711,12712,12713,12674,12675,12676,12677,12678,12679,12680,12681,12682,12683,12684,12685,12686,12687,12688,12689,12690,12691,12692,12693,12694,12695,12696,12697,12698,13856,12699,12700,12701,12702,12704,12703,12568,13872,12569,12570,12571,12573,12574,12575,12576,12577,12578,12579,12580,12581,12582,12583,12584,12585,12586,12587,12588,12589,12590,12591,13871,12592,12593,12594,12595,12596,12597,12598,12599,12600,12601,12602,12603,12604,12605,12606,13870,12607,12608,12609,12610,12611,12612,12613,12614,12615,12616,12617,12618,12619,12620
,12621,12622,12623,12624,12625,12626,12627,12628,12629,12630,12631,12632,12633,12634,12635,12636,12637,12638,12639,12640,12641,12642,12643,12644,12645,12646,12647,12648,12649,12650,12651,12652,12653,12654,12655,12656,12657,12658,12659,12660,12661,12662,12663,12664,12665,12666,12667,12668,12669,12670,12671,12672,12673,13037,13081,13082,13083,13084,13085,13086,13087,13088,13089,13090,13091,13092,13093,13094,13070,13663,13076,13077,13078,13079,13080,13071,13072,13073,13074,13075,13052,13053,13057,13058,13059,13060,13061,13062,13063,13064,13065,13066,13067,13068,13069,13054,13055,13056,13045,13046,13047,13048,13051,13049,13050,13038,13041,13042,13043,13044,13040,13039,12839,12840,12841,12842,13095,13374,13409,13412,13411,13410,13408,13404,13407,13406,13405,13403,13402,13395,13398,13401,13400,13399,13397,13396,13393,13394,13389,13392,13391,13390,13387,13388,13386,13385,13384,13383,13381,13382,13380,13379,13378,13376,13377,13375,13356,13372,13373,13371,13370,13369,13362,13367,13366
,13364,13365,13363,13368,13359,13361,13360,13357,13358,13354,13704

RE: [PHP] Problems with implode

2009-03-24 Thread Andrea Giammarchi

What about MySQL max_allowed_packet setting? is it bigger than produced string?

 To: php-general@lists.php.net
 Date: Tue, 24 Mar 2009 15:23:20 +0100
 From: t...@ezl-data.dk
 Subject: Re: [PHP] 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/