My guess is that since your id field is not auto_increment and you're not specifying a value, all email addresses are getting an id of 0. Since your primary key is composed of both id and email, MySQL isn't complaining.

[EMAIL PROTECTED] wrote:
However, Problem application is giving me is in case I unsubscribe one email it deletes all emails from database. table. I have pasted php code and mysql dump. Any guidance, please.

        //add record
        $sql = "insert into kemails values('', '$_POST[email]')";

       //unsubscribe the address
       $id = mysql_result($check_result, 0, "id");
       $sql = "delete from kemails where id = '$id'";
       $result = mysql_query($sql,$conn) or die(mysql_error());
       $display_block = "<P>You're unsubscribed!</p>";

mysql> describe kemails
    -> ;
+-------+--------------+------+-----+---------+-------+
| Field | Type         | Null | Key | Default | Extra |
+-------+--------------+------+-----+---------+-------+
| id    | int(11)      |      | PRI | 0       |       |
| email | varchar(150) |      | PRI |         |       |
+-------+--------------+------+-----+---------+-------+
2 rows in set (0.00 sec)

-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to