When retrieving multiple resultsets from a stored procedure, don't call mssql_free_statement on the statement resource, as any resultsets not yet retrieved will be lost, and mssql_next_result will report no more result sets were available.