I have this working with the exception of when there is a ' in an email address that I want to remove.
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? 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) '[EMAIL PROTECTED]','[EMAIL PROTECTED]'that.com','etc...
Need to escape the [EMAIL PROTECTED]'that.com
Thanks.
--
Chris Bruce [EMAIL PROTECTED]
Idextrus E-Business Architects http://www.idextrus.com 3282 Wilmar Cres. Mississauga, ON L5L4B2 CA 905.828.9189
**************************************************************** This e-mail and its contents are privileged, confidential and subject to copyright. If you are not the intended recipient, please delete this e-mail immediately. Any unauthorized use or disclosure of the information herein is prohibited.
On Jan 30, 2004, at 12:54 PM, John W. Holmes wrote:
From: "Chris Bruce" <[EMAIL PROTECTED]>
Mysql 3.23.54.
My first thought was to load the output from the tables into an array and they use a foreach and in_array to create a list of dups, but I wanted to see if there was an easier way.
Ah, in that case, my other query won't work. :)
This should:
<?php
$query = "SELECT list1.email FROM master_list, list1 WHERE master_list.email
= list1.email";
$result = mysql_query($query) or die(mysql_error());
while($r = mysql_fetch_assoc($result))
{ $email_list .= "'{$row['email']}',"; }
$email_list = substr($email_list,0,-1); //remove last comma
$query = "DELETE FROM list1 WHERE email IN ($email_list)"; $result = mysql_query($query) or die(mysql_error()); ?>
Repeat for other tables.
---John Holmes...
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php