Click here to Skip to main content
15,881,881 members

Comments by piano0011 (Top 1 by date)

piano0011 15-Aug-18 0:31am View    
I hope that I have entered in the correct place as I need more clarification here.. I have tried to use mysqli_stmt_affected_rows as follows:

$sql2 = "INSERT INTO questions (question_number, `text`) VALUES (?,?);";

$stmt = mysqli_stmt_init($conn);
//Prepare the prepared statement
if (!mysqli_stmt_prepare($stmt, $sql2)) {
echo 'SQL statement failed';
} else {
mysqli_stmt_bind_param($stmt, "is", $question_number, $question_text);
mysqli_stmt_execute($stmt);
$result2 = mysqli_stmt_get_result($stmt);
$resultCheck2 = mysqli_stmt_affected_rows($result2);




if ($resultCheck2 < 1) {
header("Location: header.php?add=error");
exit();

but still get the same error: