1--TEST-- 2PDO MySQL auto_increment / last insert id 3--EXTENSIONS-- 4pdo 5pdo_mysql 6--SKIPIF-- 7<?php 8require __DIR__ . '/config.inc'; 9require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; 10PDOTest::skip(); 11?> 12--FILE-- 13<?php 14require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; 15$db = PDOTest::test_factory(__DIR__ . '/common.phpt'); 16 17print_r($db->query("CREATE TABLE test (id int auto_increment primary key, num int)")); 18 19print_r($db->query("INSERT INTO test (id, num) VALUES (23, 42)")); 20 21print_r($db->query("INSERT INTO test (num) VALUES (451)")); 22 23print_r($db->lastInsertId()); 24?> 25--EXPECT-- 26PDOStatement Object 27( 28 [queryString] => CREATE TABLE test (id int auto_increment primary key, num int) 29) 30PDOStatement Object 31( 32 [queryString] => INSERT INTO test (id, num) VALUES (23, 42) 33) 34PDOStatement Object 35( 36 [queryString] => INSERT INTO test (num) VALUES (451) 37) 3824 39