简体   繁体   中英

Pear::MDB2 - get last executed query

I have to use Pear MDB2 but don't know how to get the last executed query. Is there a way to do that?

Thanks,

AS you can see in this link: https://pear.php.net/package/MDB2/docs/latest/MDB2/MDB2_Driver_Common.html#var$last_query you have a variable called $last_query that stores the last query sent to the driver.

I have not checked it, but based on the documentation you can use:

$mdb2 =& MDB2::connect('YOUR_DSN');
if (PEAR::isError($mdb2)) {
    die($mdb2->getMessage());
}

// Proceed with a query...
$res =& $mdb2->query('SELECT * FROM clients');

echo $mdb2->last_query;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM