Not sure I understood the question or if this is any help but it may get you started on the right track. After all, it's another hour until I usually wake up. Think you may be better off letting the database do all the work and try not to use the on error clause, (it will probably bring back undesired results if the script fails unless you set up some form of error control).Select the following and save it as an asp page:<%'--------------------------'Variables'-------------------------- thisDate = date() my_numbers = ",5,16,10,30,31,32" my_nos = my_numbers win_list = ",10,20,30,31,32,40," win_list = numeric2(win_list) 'This will strip out any data that isn't a number or comma match_count = 0 match_list = ""'--------------------------'Check Results'-------------------------- newSplit = split(my_numbers,",") For each my_numbers in newSplit check_number = numeric(my_numbers) if instr(win_list, ","&check_number&",")>0 then match_count = match_count + 1 match_list = match_list &","& check_number end if Next'--------------------------'Check Prizes'-------------------------- select case(match_count) case 3 prize = "balik taya" case 4 prize = "800" case 5 prize = "20000" case 6 prize = "Jackpot" case else prize = "talo" end select'--------------------------'Highlight Matches'-------------------------- if win_list<>"" then newSplit = split(match_list,",") For e = 1 to ubound(newSplit) win_list = replace(win_list,","&newSplit(e)&"," , ",<font color='#FF0000'><b>"&newSplit(e)&"</b></font>,") Next end if'--------------------------'Functions'-------------------------- function numeric(iStr) strValidChars = "0123456789" iWord = "" if iStr<>"" then For i=1 to len(iStr) iChar = mid(iStr,i,1) if instr(strValidChars,iChar)>0 then iWord = iWord & iChar Next end if numeric = iWord end function function numeric2(iStr) strValidChars = "0123456789," iWord = "" if iStr<>"" then For i=1 to len(iStr) iChar = mid(iStr,i,1) if instr(strValidChars,iChar)>0 then iWord = iWord & iChar Next end if numeric2 = iWord end function'--------------------------'Test'--------------------------' response.write prize &"<br />"' response.write win_list &"<br />"' response.write my_nos &"<br />"' response.write match_count &"<br />"' response.write match_list &"<br />"%><table border="1" width="100%"> <tr> <td>DATE</td> <td><%=thisDate%> </td> </tr> <tr> <td>RESULT</td> <td><%=win_list%> </td> </tr> <tr> <td>MATCHED NUMBERS</td> <td><%=match_list%> </td> </tr> <tr> <td>MATCHES</td> <td><%=match_count%> </td> </tr> <tr> <td>PRIZE</td> <td><%=prize%> </td> </tr></table>If that is along the right lines all you have to do is substitute the variables:my_numbers (with the numbers you are going to check)win_list (with the resultant numbers from the database query).Bear in mind that if you wanted to check on the press of a button using this method (asp) you would have to reload the page to make this code execute.Let me know how it goes.Cheers