Jump to content

[Help] Delete Multiple fields from single table


semperfi

Recommended Posts

I am trying to delete multiple fields from a single table. Here are the fields in the table;

signups_id

signup_email_address

signup_date

signup_time

 

Here is my code where I delete the data from the 'signup_email_address' and works with no issues but the other data is still there. I tried different quires but keep getting errors can someone please help with my code?

 

if(isset($_POST["unsub"]) and !empty($_POST["unsub"]))
{
	$query="delete from signups where signup_email_address='$_POST[unsub]'";	
				if(mysql_query($query,$conn))
						{

Link to comment
Share on other sites

DELETE removes the whole of the matching record (row) from the table so I don't understand how the "other data is still there".

 

Also try adding  LIMIT 1 to the end of the query just to protect yourself against accidentally deleting every record.

 

Sorry should of mentioned that it is for a unsubscribe input field where the user inputs his email address for unsubscribing ( delete his/her email from DB ). So which should I use delete or update? 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.