Here's how I would do it:
$inlist .= sprintf("\'%s\'",$Array['Email']);
Then after the loop:
$query = "DELETE FROM sometable WHERE email NOT IN (".$inlist.")";
mysql_query($query);
----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, March 29, 2001 5:02 PM
Subject: Delete?
> Hi,
>
> I`m just trying to figure out the best method to delete my records and
> wondered if it was possible to do a DELETE statement to remove any records
> that don`t match.
>
> Here is my code so far
>
> $Query="select blah its huge:-)";
> $RESULT=mysql_query($Query);
> $my_rows=mysql_num_rows($RESULT);
>
> for ($a=0; $a<$my_rows; $a++)
> {
> mysql_data_seek($RESULT, $a);
> $Array = mysql_fetch_array($RESULT);
> printf("%s", $Array['Email']);
> }
>
> My Query returns Matched Records, what I would like to achieve is deletion
of
> the records that didn`t match, would it be possible to do that under the
> printf statement. So delete all the records in the table that don`t match
up
> to $Array['Email'] ??
>
> Thanks for any input
> Ade
>
> ---------------------------------------------------------------------
> Before posting, please check:
> http://www.mysql.com/manual.php (the manual)
> http://lists.mysql.com/ (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail <[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>
>
>
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php