Quote:
Originally Posted by doubledee
But that is almost identical to what I have?!
|
yes because you simply switched results to error , you need to set
either and check
both
e.g.
PHP Code:
if (mysqli_stmt_affected_rows($stmt3)==1){
// Insert Succeeded.
$_SESSION['resultsCode']['result'] = 'COMMENT_MEMBER_COMMENT_ADDED_2052';
// Set values for Success Message.
$_SESSION['firstName'] = $firstName;
$_SESSION['heading'] = $heading;
// Notify Other Subscribed Members
notifySubscribersOfNewComment($dbc, $articleID, $commentID, $sessMemberID);
}else{
// Insert Failed.
$_SESSION['resultsCode']['error'] = '2';
// Set Error Source.
$_SESSION['errorPage'] = $_SERVER['SCRIPT_NAME'];
// Redirect to Display Outcome.
header("Location: " . BASE_URL . "/account/results.php");
}// End of VERIFY INSERT.
& in results.php e.g.
PHP Code:
$errors=array(
2=>array('msg'=>'you did this wrong','ID'=>'COMMENT_MEMBER_COMMENT_ADDED','gen_email'=>false),
4=>array('msg'=>'you did that wrong','gen_email'=>false),
8=>array('msg'=>'you did the other wrong','gen_email'=>true),
//etc
)
if($_SESSION['resultsCode']){
if($_SESSION['resultsCode']['result']){
//do whatever you want to do here
}
if($_SESSION['resultsCode']['error']){
//its an error you may have other things to do now?
//check $errors[$_SESSION['resultsCode']['error']]; for what
}
}
as for what is an error... whatever you class as an error but you posted here because you were getting emails for every member action, something I assume you want to avoid... the above is one (simplistic) way of modifying your existing code.