Page 1 of 1

function

Posted: Wed May 07, 2008 8:05 am
by psurrena
Is there a function that would replace the spaces in a string? Like concat but only one row.

For example: "I am a machine" would become "I,am,a,machine".

Thanks!

Re: function

Posted: Wed May 07, 2008 8:16 am
by Apollo
$result = str_replace(" ", ",", $yourText);

Re: function

Posted: Wed May 07, 2008 8:22 am
by psurrena
Thanks, but I wanted to do this in the query and not in PHP.

Re: function

Posted: Wed May 07, 2008 8:51 am
by EverLearning
MySql String Functions

[sql]SELECT REPLACE("I am a machine", ' ', ',');[/sql]

Use Google. I found this by entering the following query - mysql string replace