This is exactly what I need:
<?php
$conn = mysqli_connect($server, $buser, $pwd, $db);
$query = $conn->query("mysql_query here");
if (!query) {
$error = $conn->error;
$log_error = $conn->query("INSERT INTO tab (log) VALUES ('$error')");
}
?>
However, this does not work, the error is not being submitted into the db.
For how much it actually is bad to use a database to log errors, seems the only way to accomplish my needs.
What is needed: I need to log all errors from queries, no matter of the type, and log them somewhere which can be viewed on a private webpage accessible just for a specified level account with PHP just to display all those errors.
I already have everything working, account levels etc, just it seems can't find a way to log past occured errors on a php page in the following format:
account_who_caused_error || page_where_error_occured.php || error_message || datetime
error_log cannot be used due to the nature of what i need. so what exactly remains to do that?
$conn?$errorvariable?$log_error = $conn->query("INSERT INTO tab (log) VALUES ('" . mysqli_real_escape_string($error) . "')");