Jump to content

Deleting a database entry, Help Please??


craigtolputt

Recommended Posts

Hi Guys,

 

I have a flash form that enters a users email address into a database which works fine but i need to have another form that deletes their email address so i thought it would be something like...

 

<?php

include "connect.php";

$tableName = "usersv2";

$email = $_POST['email'];

$insert = mysql_query("DELETE FROM $tableName (email) VALUES ('$email')";
$headers = "From: [email protected]\r\n";
$headers.= "Content-Type: text/html; charset=ISO-8859-1 ";
$headers .= "MIME-Version: 1.0 ";

$msg = "Thanks, your email address has been removed";

mail($email,"Thanks, your email address has been removed!",$msg,$headers);

echo "&msgText=Email Removed!";

?>

 

 

 

This doesnt seem to work though

 

any ideas??

Link to comment
https://forums.phpfreaks.com/topic/148102-deleting-a-database-entry-help-please/
Share on other sites

include "connect.php";

$tableName = "usersv2";

$email = mysql_real_escape_string($_POST['email']);

$delete= mysql_query("DELETE FROM $tableName WHERE email = '$email'") or trigger_error(mysql_error());
  
if($delete== 1){
   $headers = "From: [email][email protected][/email] ";
   $headers.= "Content-Type: text/html; charset=ISO-8859-1 ";
   $headers .= "MIME-Version: 1.0 ";

   $msg = "Thanks, your email address has been removed";

   mail($email,"Thanks, your email address has been removed!",$msg,$headers);

   echo "&msgText=Email Removed!";
}

What i thought was if i set a cron job up to run a php script once a week then the script can check a column in the news table like isNEW = 1 or something if it does equal 1 then the script will add it to an email and send that email out to my email address's in another table?

 

 

Ah, ok.

 

Sorry im not a PHP developer im a flash developer but need to try and get this done.

 

So in the news table there are the following fields...

 

newsid

catalogid

title

content

picture

viewnum

adddate

rating

ratenum

source

sourceurl

isdisplay

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.