runnerjp Posted November 16, 2008 Share Posted November 16, 2008 <?php $updateemail = "UPDATE forum_email SET mailed=0 WHERE topic_id='$forumpostid'"; mysql_query($updateemail) or die("Could not update post");// this works as it sets them to 0 $updateuseremail = "UPDATE forum_email SET mailed=1 WHERE topic_id='$forumpostid' AND user_id='$id'"; mysql_query($updateuseremail) or die("Could not update post");// but this does not set the users one back to 1?> Link to comment https://forums.phpfreaks.com/topic/132969-solved-page-not-updating/ Share on other sites More sharing options...
redarrow Posted November 16, 2008 Share Posted November 16, 2008 try know.. $updateuseremail = "UPDATE forum_email SET mailed='1' WHERE topic_id='$forumpostid' AND user_id='$id'"; mysql_query($updateuseremail) or die("Could not update post"); Link to comment https://forums.phpfreaks.com/topic/132969-solved-page-not-updating/#findComment-691480 Share on other sites More sharing options...
runnerjp Posted November 16, 2008 Author Share Posted November 16, 2008 sadly not... heres full code <?php $query = "SELECT fe.*, u.email, u.ID FROM forum_email as fe INNER JOIN users as u ON u.ID = fe.user_id WHERE fe.topic_id = $forumpostid AND fe.user_id != $id AND fe.mailed=1"; $res = mysql_query($query) or die ("$query fails : ".mysql_error()); //nobody wants an email, stop now if(mysql_num_rows($res)==0) { echo "no records returned"; exit; } // ADDED CODE TO SEND EMAIL MESSAGES $subj = 'Forum Updated'; $from = "From: [email protected]"; $text = ' [your message text] '; while ($row = mysql_fetch_assoc($res)) { extract ($row); if (!mail($email, $subj, $text, $from)) { echo "<br />MAIL FAILED FOR $email \n"; } } //set emailed to 'y' so that they don't get numerous emails... set it back to 'n' when they view this topic $updateemail = "UPDATE forum_email SET mailed=0 WHERE topic_id='$forumpostid'"; mysql_query($updateemail) or die("Could not update post"); $updateuseremail = "UPDATE forum_email SET mailed='1' WHERE topic_id='$forumpostid' AND user_id='$id'"; mysql_query($updateuseremail) or die("Could not update post");?> Link to comment https://forums.phpfreaks.com/topic/132969-solved-page-not-updating/#findComment-691487 Share on other sites More sharing options...
redarrow Posted November 16, 2008 Share Posted November 16, 2008 try some valadation to see if it correct in the update then......... also i dont see no $_post[''] varables........ <?php $updateuseremail = "UPDATE forum_email SET mailed='1' WHERE topic_id='$forumpostid' AND user_id='$id'"; mysql_query($updateuseremail) or die("Could not update post mysql_error()"); echo $updateuseremail; ?> Link to comment https://forums.phpfreaks.com/topic/132969-solved-page-not-updating/#findComment-691505 Share on other sites More sharing options...
runnerjp Posted November 16, 2008 Author Share Posted November 16, 2008 ah got it... forgot this part... if u look i did echo "no records returned"; exit; so the script would run Link to comment https://forums.phpfreaks.com/topic/132969-solved-page-not-updating/#findComment-691589 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.