php - Mysqli_error() returns a blank page

299

I am trying to run a query that calls a stored procedure but this does not work due to some errors. Unfortunately, I can't see the error because mysqli_error() keeps returning a blank screen. Please do I get the error to show. I have been on this for hours.

Here is my code:

$ID = $_SESSION['ID'];
$sql = "CALL selCash('$ID')";
$result = mysqli_query($this->con,$sql); 
mysqli_next_result($this->con); 
if($result === false){
    die(mysqli_error($this->con));
}else{
    die("good");
}
return $result;
402

Answer

Solution:

You can try display all errors:

error_reporting(E_ALL);
ini_set('display_errors', 1);

Also you can usetry catch and set mysqli error reports to all:

mysqli_report(MYSQLI_REPORT_STRICT | MYSQLI_REPORT_ALL);

try {
    $result = mysqli_query($this->con,$sql); 
    mysqli_next_result($this->con); 
    if($result === false){
        die(mysqli_error($this->con));
    }else{
        die("good");
    }
} catch (mysqli_sql_exception $e) {
    ...
}

People are also looking for solutions to the problem: How can I read php file's output into a variable?

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.