使用PHP本机获取最后执行的查询
我的代码如下:使用PHP本机获取最后执行的查询,php,postgresql,Php,Postgresql,我的代码如下: $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_arra
$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));
我想回显上次查询插入
如何使用PHP native获取上次执行的查询?这是我在本地测试过的代码,工作正常你想要mysql还是postgresql?@SomnathMuluk,potgresql
pg_exec
不是PHP方法你在这个应用程序中有mysql和postgresql数据库吗?@worldofjr,我从mysql数据库获取数据,并将数据输入postgresql数据库。我不知道如何echo last query
在正常的phpIn codeigniter中使用:echo$this->db->last_query()代码>。在php本机中?