$result = mssql_query("SELECT @@IDENTITY"); list($affected) = mssql_fetch_row($result);