我遇到了一些问题,因为无法使用自动增量工作来获取插入存储过程mysql。请不要标记重复。
//connect to database
$connection = mysqli_connect("localhost", "user", "password", "buildings", "3306");
//Having trouble with insert stored procedure in which i've never done that part before and also, I'm not sure
//if the mysql_insert_id()) would work because it is auto increment
$Firstname = "Aaron";
$Lastname = "johnson";
$Password = "323";
$EmailAddress = "aaron@gmail.com";
$Salt = "23";
$RoleID = "1";
// tried passing the parameters and it still didn't work.
$sql = $connection->multi_query( "CALL registerusers(@new_id,$Firstname,$Lastname,$Password,$EmailAddress,$Salt,$RoleID);SELECT @new_id" );
echo "new record has id:" . mysqli_insert_id($connection);
这是mysql中创建表用户的the link。
这是the link,用于存储过程在mysql中插入存储过程
这是php消息的结果,显示“新记录有id:0”