I have the following code that is not throwing an error like I am used to...
// Build query.
$q2 = "SELECT MAX(comment_no) AS lastCommentNo
// Prepare statement.
$stmt2 = mysqli_prepare($dbc, $q2);
// Bind variable to query.
mysqli_stmt_bind_param($stmt2, 'i', $articleID);
// Execute query.
// Store results.
// Check # of Records Returned.
// Maximum Found.
// Bind result-set to variables.
// Fetch record.
// Increment CommentNo.
$commentNo = $lastCommentNo + 1;
// Maximum Not Found.
$_SESSION['resultsCode'] = 'COMMENT_MAXIMUM_NOT_FOUND_2049';
Normally to test the "Error Branch" of my code above, I would change $articleID to $articleID2, thus breaking my query and launching the ELSE branch of my code with the Error-Message.
The problem seems to be that $articleID2=0 and so my query returns a NULL for the MAX() which technically counts as a row being returned?!
That isn't the behavior I am looking for.