I've done this in ASP with SQL v7 and 2000.
In ASP, I couldn't just run my insert query and then run a 2nd query to select @@IDENTITY (which is what you need to do, I believe - I haven't looked at the PHP MS SQL functions).
What I had to do was execute (not query) the insert query, then execute the 2nd query to fetch the @@IDENTITY ("SELECT @@IDENTITY AS myID").
I'm just guessing here. Check out the PHP MS SQL functions and see if: there's a function to grab the ID. If not, then check if there's a function which does an execute instead of "query". If so, use it to do the insert and then do the 2nd select query.