if(isset($_POST['submit']))
{
$question_Desc = $_POST['question_Desc'];
$question_EndDate = $_POST['question_EndDate'];
$question_Week = $_POST['question_Week'];
$query = "INSERT INTO question (question_Desc, question_Week, question_Correct_Answer, question_EndDate, module_Code)
VALUES ('$question_Desc', $question_Week, 0, '$question_EndDate', '$module')";
$echo = "Failed adding the question to the database";
mysql_query($query)or die("<script type='text/javascript'>
var divid = document.getElementById('notify');
divid.style.display = 'block';
divid.innerHTML = '".$echo."';
</script>");
// the code you want to echo
// script to display it
$echo = "Succeeded adding the question to the database";
// script to display it
echo "<script type='text/javascript'>
var divid = document.getElementById('notify');
divid.style.display = 'block';
divid.innerHTML = '".$echo."';
</script>";
}
The question is, when the mysql fails, it goes on to die(), and then doesn't continue print below (which is html)
I need an alternative to die for catching mysql errors