문제

When using $db->sql_query in PHPBB3, how would I get the id of a row created with an insert statement?

도움이 되었습니까?

해결책

Use:

SELECT LAST_INSERT_ID()

Reference:

다른 팁

in phpBB3 you get an even better way, the dbal go a function for this: $db->sql_nextid():

$sql = 'INSERT INTO ' . USERS_TABLE . ' ' . $db->sql_build_array('INSERT', $user_ary);
$db->sql_query($sql);

$user_id = $db->sql_nextid();
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top