Ask Your Question
1

What is the method for showing errors in mysqli_query?

asked 2021-08-15 11:00:00 +0000

lalupa gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2021-11-11 13:00:00 +0000

huitzilopochtli gravatar image

To show errors in mysqli_query, the following method can be used:

Step 1: Set the error reporting to maximum by adding the following code at the beginning of the PHP file:

errorreporting(EALL); iniset('displayerrors', 1);

Step 2: After executing the mysqliquery function, use the mysqlierror function to display any errors that may have occurred.

For example:

$query = "SELECT * FROM users"; $result = mysqli_query($connection, $query);

if (!$result) { die('Query Failed: ' . mysqli_error($connection)); }

This will display any errors that occurred during the execution of the mysqli_query function.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2021-08-15 11:00:00 +0000

Seen: 19 times

Last updated: Nov 11 '21