Re: Comparing multiple Mysql tables to find duplicates
| From: | Jason Wong | Date: | Tue, 03 Feb 2004 16:19:56 +0000 |
| Subject: | Re: Comparing multiple Mysql tables to find duplicates | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-176693@lists.php.net to get a copy of this message | ||
On Wednesday 04 February 2004 00:09, Chris Bruce wrote:
> I have modified your line { $email_list .= "'{$row['email']}',";
> },
> with { $email_list .= str_replace("'", "\'",
> "'{$r[email]}',"); }, but
> now it escapes all the single quotes. Is there a php function that
> escapes single quotes in Mysql queries?
Yes, surprisingly enough it's called mysql_escape_string().
> If not, do you know the best
> way to escape *only* single quotes in the email address string and not
> the single quotes surrounding the string?
>
> Example (output of $email_list)
> 'this@that.com','this@o'that.com','etc...
> Need to escape the this@o\'that.com
I don't understand why you want to escape the single-quote. You shouldn't be
allowing such entries anyway because quotes are not valid characters for
domain names thus it's an invalid email address.
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
Trust everybody, but cut the cards.
-- Finlay Peter Dunne, "Mr. Dooley's Philosophy"
*/