MSSQL last insert id
Using SCOPE_IDENTITY(),
$result = sqlsrv_query($conn, 'INSERT INTO mytable(name) values ('hello world') ;
SELECT SCOPE_IDENTITY() AS ID', array(), $option);
sqlsrv_next_result();
$row = sqlsrv_fetch_object($result);
echo $row->ID; //last insert id