Is it possible to export the query formatted by mysqli::prepare
and ::bind_param
?
Example:
<?php
$mysqli = new mysqli('host', 'user', 'pass', 'table');
if(mysqli_connect_errno()){
printf('Connect failed: %s\n', mysqli_connect_error());
exit;
}
$data=7290;
if ($stmt = $mysqli->prepare('SELECT `id`,`info` FROM `propertys` WHERE id>?')){
$stmt->bind_param('i',$data);
$stmt->execute();
$stmt->bind_result($id,$info);
while($q=$stmt->fetch()){
echo $id,': ',$info,'<br>';
}
$stmt->close();
}
$mysqli->close();
?>
I would like to export the QUERY
functions performed by mysql::prepare
and bind_param
so (this is an imaginary example):
if ($stmt = $mysqli->prepare('SELECT `id`,`info` FROM `propertys` WHERE id>?')){
$stmt->bind_param('i',$data);
$stmt->execute();
echo $stmt->exportQuery();//Function does not exist, just for example
The function ::exportQuery
would print like this:
SELECT `id`,`info` FROM `propertys` WHERE id>7290
is there any solution?
Thanks.