weetat wrote:
 I have a sql statement below :
UPDATE tbl_chassis_temp SET country = 'Singapore', city 'SINGAPORE', building = 'Tampines Central 6', other = 'Level 03-40',
I need to remove the last comma from sql text above.
I have tried using substr and rtrim , without any success ?


At 06:10 PM 6/8/2006, Chris wrote:
How about:

$query = substr(trim($query), 0, -1);

This feels like a hack to me -- it acts blindly, assuming that just the comma and no extra spaces are at the end of the string. Better I think to intelligently remove just those characters one wishes to remove.


At 03:00 PM 6/9/2006, Richard Lynch wrote:

rtrim() won't work, as ',' is not whitespace.

Richard, you're wrong -- read the manual. All three functions trim(), ltrim(), and rtrim() allow you to append an optional list of characters to be trimmed:

http://php.net/trim
http://php.net/ltrim
http://php.net/rtrim

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

Reply via email to