Zderadicka Jan - IN wrote:
> Hi !
> I have a problem when trying to make a SELECT with REPLACE.
> I have a text with email addresses and I would like to make them
> active. It means to rewrite them to HTML language.
> Consider text: "Hello, my address is go@stripped and you can use it".
> ==== >
> which I would like to change to:
> "Hello, my address is <A HREF="mailto: go@stripped">go@stripped</A>"
> I decided to use the syntax:
> SELECT REPLACE($text, $mail, $newmail) where $text is the variable
> which includes the plain text and email addresses, $mail is the
> concrete mail I am searching (e.g. go@stripped) and $newmail stands
> for email writen in HTML language. (<A HREF... etc.).
> Unfortunately this syntax does not work. But probably not because of
> the syntax itself, but because Mysql can't replace the previous email
> with HTML language. The problem is with "<" and ">" characters.
> Do you know, how to replace any text with the combination of "<>"
> characters ? These characters are not consider as special I think and
> that's why I think quoting with "\" is not needed.
> I am using PHP to get to Mysql database.
> John Zderadicka
A SELECT statement _never_ changes the contents of tables.
Therefore you have to use UPDATE like that:
UPDATE tablename SET $text=REPLACE($text, $mail, $newmail) WHERE ...
|• Problem with REPLACE||Zderadicka Jan - IN||17 Mar|
| • Re: Problem with REPLACE||Christian Mack||17 Mar|