1--TEST-- 2PDO MySQL auto_increment / last insert id 3--EXTENSIONS-- 4pdo_mysql 5--SKIPIF-- 6<?php 7require_once __DIR__ . '/inc/mysql_pdo_test.inc'; 8MySQLPDOTest::skip(); 9?> 10--FILE-- 11<?php 12require_once __DIR__ . '/inc/mysql_pdo_test.inc'; 13$db = MySQLPDOTest::factory(); 14 15print_r($db->query("CREATE TABLE test_last_insert_id (id INT AUTO_INCREMENT PRIMARY KEY, num INT)")); 16 17print_r($db->query("INSERT INTO test_last_insert_id (id, num) VALUES (23, 42)")); 18 19print_r($db->query("INSERT INTO test_last_insert_id (num) VALUES (451)")); 20 21print_r($db->lastInsertId()); 22?> 23--CLEAN-- 24<?php 25require_once __DIR__ . '/inc/mysql_pdo_test.inc'; 26$db = MySQLPDOTest::factory(); 27$db->query('DROP TABLE IF EXISTS test_last_insert_id'); 28?> 29--EXPECT-- 30PDOStatement Object 31( 32 [queryString] => CREATE TABLE test_last_insert_id (id INT AUTO_INCREMENT PRIMARY KEY, num INT) 33) 34PDOStatement Object 35( 36 [queryString] => INSERT INTO test_last_insert_id (id, num) VALUES (23, 42) 37) 38PDOStatement Object 39( 40 [queryString] => INSERT INTO test_last_insert_id (num) VALUES (451) 41) 4224 43