使用PHP本机获取上次执行的查询


Get last executed query with PHP native

我的代码如下:

$q = mysql_query('SELECT a, b, c FROM `tb_mysql`');
$dbconn = pg_connect("host=localhost port=5432 dbname=db_postgresql user=postgres password=1234") or die('Could not connect: ' . pg_last_error());
$sql = array();
while($r=mysql_fetch_array($q)) {
    $sql[] = '('''.$r['a'].''','''.$r['b'].''','''.$r['c'].''')';
}
$q = pg_exec($dbconn, "INSERT INTO tb_postgresql(a, b, c) VALUES ".implode(',', $sql));

我想echo last query insert

如何使用PHP本机获取上次执行的查询?

这是我在本地测试的代码,它的工作性能良好