更新时间:2023-01-22 16:53:31
我使此函数变得容易:)...如果您有多个db资源,只需将其传递给mssql_query请求即可.这将检索在该资源连接上生成的最后一个唯一ID.
I made this function to make it easy :)... if you have more then one db resource just pass that into the mssql_query request. This will retrieve the last unique id generated on that resource connection.
mssql_query("insert into data(name) values('bob')");
$id = getLastId();
function getLastId() {
$result = mssql_fetch_assoc(mssql_query("select @@IDENTITY as id"));
return $result['id'];
}