Cannot display mysqli_error($con) ???
This PHP script fails to display an error message when I deliberately induced an error by providing a wrong B_ID from TableB (its an FK constraint):
<?php
$con = mysqli_connect("localhost", usr, pwd, instance);
mysqli_set_charset( $con, "utf8mb4" );
if (mysqli_connect_errno($con)) {
die('Failed to connect to MySQL : ' .mysqli_connect_error());
}
$aA= (int)$_POST['AA'];
$aB= (int)$_POST['AB'];
$c3po= $_POST['C3PO'];
$qA = "SELECT A_ID from TableA WHERE A_ID='$aA'";
$rA = mysqli_query($con,$qA);
$numA = (int)mysqli_num_rows($rA);
$qB = "SELECT B_ID from TableB WHERE B_ID='$aB'";
$rB = mysqli_query($con,$qB);
$numB = mysqli_num_rows($rB);
if ($numA==1 && $numB==1){
$newC= "call sp_intoTableC ('$aA', '$aB','$c3po')";
$rNewC = mysqli_query($con,$newC);
if ($rNewC) {
printf("\"".$numA."\"". " and ". "\"".$numB."\"". " have been posted.");
} else { echo mysqli_error($con); } // INDUCE ERROR: THIS DOES NOT GET DISPLAYED !?!
}
mysqli_close($con);
?>
Thanks.
Subject
Written By
Posted
Cannot display mysqli_error($con) ???
January 25, 2019 12:32AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.