您好,欢迎访问一九零五行业门户网

PHP 使用 POD 访问mysql数据库,怎么返回上一个插入记录的自增编号ID

php 使用 pod 访问mysql数据库,如何返回上一个插入记录的自增编号id
php 使用 pod 访问mysql数据库,如何返回上一个插入记录的自增编号id
分享到: 更多
------解决方案--------------------
string pdo::lastinsertid ([ string $name = null ] )
------解决方案--------------------
prepare(insert into test (name, email) values(?,?));
try { 
        $dbh->begintransaction(); 
        $tmt->execute( array('user', 'user@example.com')); 
        $dbh->commit(); 
        print $dbh->lastinsertid(); 
    } catch(pdoexecption $e) { 
        $dbh->rollback(); 
        print error!:  . $e->getmessage() . ; 
    } 
} catch( pdoexecption $e ) { 
    print error!:  . $e->getmessage() . ; 

?>
其它类似信息

推荐信息