Thanks again. Only one problem left I think!
It claims "not a valid MS SQL-result resource", but when I run the query in Enterprise Manager it returns the @@IDENTITY row with no problems.
$sql = "SET nocount ON; INSERT INTO $table (Date,OrderbyID,FaxNumber,orderresult,Cred_Id,Attention,IsSent) VALUES ('$reqdate','$orderedbyid','$faxnumber','$orderresult','$crednumber','$attention','1'); SELECT @@IDENTITY";
$result= mssql_query($sql,$db);
$lastrow = mssql_result($result,0,0);
Am I on the right track with this?
EDIT:
This code works perfectly, but not when I try to combine the queries. It just won't recognise the result as a valid resource. Any ideas? Because even though these lines of code are right next to each other, I really don't want to have problems when multiple people are using the form! Thanks.
mssql_query($sqlinsert,$db);
$lastrow = mssql_result(mssql_query("SELECT @@IDENTITY FROM tblname",$db),0,0);