I'm a bit not understanding - on update, insert, delete queries result_metadata returns false? Because:
$meta = $stmt->result_metadata();
if($meta === false){
throw new Exception(...));
}
throws the exception when i try to run update, insert or delete query. But it should be false only on error. (from php manual)
The function is intended to return data about the data you've just made a query about (metadata!). The action of inserting rows, updating rows, and deleting rows usually doesn't actually return a result set.
(At least not in MySQL. In certain other databases, like Postgres, there's the
RETURNING
clause...)From the comments on the
mysqli_stmt_result_metadata
manual page: