gpt4 book ai didi

php - 多个 INSERT 查询获取每个的last_insert_id

转载 作者:行者123 更新时间:2023-11-29 12:15:52 24 4
gpt4 key购买 nike

mysql_query( "INSERT INTO users(email, password) VALUES ('$email','$password')" );
$user_id = mysql_insert_id( );

mysql_query( "INSERT INTO business_details ( business_id, name, address, city, state, country, pincode) VALUES ('$category','$business_name', '$business_address', '$city', '$state', '$country', '$pincode')" );
$idB = mysql_insert_id( );

mysql_query( "INSERT INTO user_profiles (name, phone, user_id, business_details_id) VALUES ('$person_name', '$phone_number', '$user_id', '$idB')" );

将所有查询插入一个的最佳方法是什么?可能吗?

最佳答案

不,MySQL 不支持它 - 只有 Oracle 可以做到。

关于php - 多个 INSERT 查询获取每个的last_insert_id,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29815522/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com