You have a hidden issue with the extra trailing comma.
When I want a list of things, I prefer this approach:
$db = mysql_select_db("tkenet_db");
$query = "SELECT app_name,status FROM approval_list where doc_no='6'";
$result = mysql_query($query,$db);
$ccs=array();
while( $data = mysql_fetch_row($result) ){
$ccs[] = trim($h->get_email($data[0]));
}
$cc = join(",",$ccs);
It seems happy with large arrays (10,000s).
Regards
Jeff
-----Original Message-----
From: Mark Maggelet [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 22, 2001 12:20 AM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: [PHP] trim string
On Wed, 21 Mar 2001 18:09:47 +0800, Wen Ni Leong
([EMAIL PROTECTED]) wrote:
>I need help in this basic string function.
>I query from the database by using while loop and the result in in
>array. I separated them by using "," .
>
>I want at the end of the string to be trim off. Unfortunately I
>tried
>all the string function such as chop,trim and substr but they seem
>like
>can't manage to trim the end of the string. Please help me.
>
>my coding are:
>
>$db = mysql_select_db("tkenet_db");
>$query = "SELECT app_name,status FROM approval_list where
>doc_no='6'";
>$result = mysql_query($query,$db);
>while($data = mysql_fetch_row($result)){
>
> $cc .= $h->get_email($data[0]).",";
>
> if ($data[1] != 'Y')
> { $all_yes = 1;}
> }
> trim($cc);
^^^^^^^^^^^^
this doesn't do anything to $cc, you have to catch the return value:
$cc=trim($cc);
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]