$users_connected = mssql_num_rows( mssql_query("SELECT memb___id FROM MEMB_STAT WHERE ConnectStat = '1'") ); $record = mssql_fetch_row( mssql_query("SELECT Record FROM Record") ); if($users_connected > $record[0]){ mssql_query("UPDATE Record SET [Record]='$users_connected'"); }