On Mon, 2004-08-09 at 18:46, [EMAIL PROTECTED] wrote: > Dear Friends, > > I have PHP application where I enter emails and emails get stored in > mysql database,table, I have an option to unsubscribe as well, which > works, > > > 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.
This is not really a PHP installation issue, is it? I don't have time to actually run your code, but if I may suggest the way I would look at debugging the problem, perhaps that would help. When you have several email addresses in the database, have a look at their values. From the mysql prompt "select * from kemails;" will show you the list of records. As your code is trying to delete a single record with the statement "delete from kemails where id = '$id'", if it deletes all records then you can be sure the sql statement matched all records. That is, all the records have their "id" field set to the same thing. This is what looking at the records as I suggested in the last paragraph would show you. By the way, you do not need quotes around a numeric field, only varchar. Where you insert records, you use the statement "insert into kemails values('', '$_POST[email]')". Note that you have not put in a value for the "id" field. You have a default value of 0, so 0 is put in. That is what happens for _all_ records inserted. Thus they all have the same value, thus they will all get deleted at once. If you change the definition of the "id" field to something like: id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT then an ascending number will be put in automatically for you. Look in the MySQL documentation for AUTO_INCREMENT. Hope this helps. Chris