Re: deleting records
| From: | John Hughes | Date: | Sun, 07 Apr 2002 18:15:27 +0000 |
| Subject: | Re: deleting records | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-18293@lists.php.net to get a copy of this message | ||
This was, of course, an example where the PHP code was introducing an error.
The delete sql works as expected and deletes all matching email.
Next time I'm going to sleep on a problem before posting.
----- Original Message -----
From: "John Hughes" <john@jomari.com>
To: <php-db@lists.php.net>
Sent: Sunday, April 07, 2002 12:51 AM
Subject: [PHP-DB] deleting records
> It's late and I'm getting groggy.
>
> I have a table called mail_list. There are four possible list_names.
>
> I want to be able to either delete an email associated with a particular
> list or all matching email.
>
> Deleting WHERE email AND list match works fine. The problem is when I
want
> to delete an address from all of the lists.
>
> First I check the database to see how many matches I have.
>
> $check_sql = "
> SELECT list_id, email FROM mail_list
> WHERE email = '$this_email'
> ";
>
> For purposes of discussion, we'll say the answer was 3.
>
> I use this sql when I want to delete all of the email addresses:
>
> $remove_sql = "
> DELETE FROM mail_list
> WHERE
> email ='$this_email'
> ";
>
> Only the first record is deleted even though the check_sql found more than
> one match.
>
> Why doesn't the delete get all of the email addresses that match the first
> time?
>
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>