Jump to content

[SOLVED] update +1


merylvingien

Recommended Posts

if (!isset($_POST['emailid'])) {echo 'There appears to be a problem, please go back and try again.'; exit;}
else
if (isset($_POST['emailid'])) {$emailid= $_POST['emailid'];}
$emailid= mysql_real_escape_string($emailid, $con);
$emailid= htmlspecialchars($emailid);

if (strlen($emailid) >5) {echo 'There appears to be a problem, please go back and try again.'; exit;}
else

$sql = ("SELECT * FROM postcode WHERE postcodeID='$emailid'")or die ('<p>There seems to be a problem, please try again.</p>');
$result = mysql_query($sql,$con);
$row = mysql_fetch_assoc($result);

$name = $_POST["name"];
$from = "[email protected]";
$contact = $_POST['contact'];
$message = $_POST["message"];

$verif_box = $_REQUEST["verif_box"];
$name = stripslashes($name);
$message = stripslashes($message); 
$from = stripslashes($from); 

if(md5($verif_box).'a4xn' == $_COOKIE['tntcon']){

$sql = "UPDATE postcode SET mailcount = mailcount + 1 WHERE postcodeID=$emailid";
      mysql_query($sql) or trigger_error('<p>There seems to be a problem, please try again soon.</p>');
      $result = mysql_query($sql);
mail("{$row['email']}", 'some message ', "\n $name just sent you a message  \n Their email address is: $contact  \n Their message is: $message  " , "From: $from" );

setcookie('tntcon','');
} else {
// if verification code was incorrect then return to contact page and show error
header("Location:".$_SERVER['HTTP_REFERER']."?subject=$subject&from=$from&message=$message&wrong_code=true");
exit;
}
?>

Link to comment
https://forums.phpfreaks.com/topic/181773-solved-update-1/#findComment-958672
Share on other sites

Right, you are actually calling it twice:

 

   $sql = "UPDATE postcode SET mailcount = mailcount + 1 WHERE postcodeID=$emailid";
      mysql_query($sql) or trigger_error('<p>There seems to be a problem, please try again soon.</p>');
      $result = mysql_query($sql);

 

Of course it'll update twice when you call it twice.

Link to comment
https://forums.phpfreaks.com/topic/181773-solved-update-1/#findComment-958675
Share on other sites

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.