Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
PHPBB3 で使用$db->sql_queryする場合、ステートメントで作成された行の ID を取得するにはどうすればよいinsertですか?
$db->sql_query
insert
phpBB3 では、さらに良い方法が得られます。dbal はこのための関数になります: $db->sql_nextid() :
$sql = 'INSERT INTO ' . USERS_TABLE . ' ' . $db->sql_build_array('INSERT', $user_ary); $db->sql_query($sql); $user_id = $db->sql_nextid();
使用する:
SELECT LAST_INSERT_ID()
参照: