RE: [PHP] Delete Problem
| From: | Sam Masiello | Date: | Fri, 30 Mar 2001 16:57:51 +0000 |
| Subject: | RE: [PHP] Delete Problem | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-46350@lists.php.net to get a copy of this message | ||
Correct me if I am wrong, but I thought that using IN needed to be followed
by a comma separated list (with each value individually separated from the
others) like this:
$query="DELETE FROM EmailAddress WHERE Email NOT IN ('value1', 'value2',
....., 'value_n')" ;
if you want to use a comma separated list, you can use the find_in_set
function:
$query="DELETE FROM EmailAddress WHERE !find_in_set(Email,
'value1,value2,value3, ....,value_n') " ;
HTH
Sam Masiello
Systems Analyst
Chek.Com
(716) 853-1362 x289
smasiello@chekinc.com
-----Original Message-----
From: KPortsmout@aol.com [mailto:KPortsmout@aol.com]
Sent: Friday, March 30, 2001 7:15 AM
To: php-general@lists.php.net
Subject: [PHP] Delete Problem
Hi,
Can anyone see a problem with this?
<?
$dbase="Failed_Signups";
// Connect to MySQL
$Connect=mysql_connect("", "", "");
$www_domain="select Failed_Signups.EmailAddress.Email from
Failed_Signups.EmailAddress left join www_domain_net.Members on
Failed_Signups.EmailAddress.Email=www_domain_net.Members.EmailAddress where
www_domain_net.Members.EmailAddress is null";
$www_domainRESULT=mysql_query($www_domain);
$www_domain_rows=mysql_num_rows($www_domainRESULT);
for ($a=0; $a<$www_domain_rows; $a++)
{
$www_domain_Array = mysql_fetch_array($www_domainRESULT);
printf("%s", $www_domain_Array['Email']);
$inlist .= sprintf("%s", $www_domain_Array['Email']);
if($a < $www_domain_rows - 1) {
$inlist .= ", ";
}
}
echo"$inlist";
$query="DELETE FROM EmailAddress WHERE Email NOT IN $inlist";
$query1=mysql_db_query($dbase, $query) or die("Problem1");
// Close MySQL Connection
mysql_close($Connect);
?>
It keeps stopping on $query1
thanks
Ade
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net