cant u just use some function?? function category($number){ //evaluate the formula using string/numerical formula //and return the value(golden/silver etc....) } i'll prefer this method if i have to do it only once and save the results in the database(select-process-update) u'll hav to process 3000-4000 numbers at a time using this method to prevent server overload but if you hav to do the same thing repeatedly (if u want to save space at the cost of speed, but i dont think this is advisable with 1000000+ entries) i recommend mysql stored procedures. u can find a tutorial here<http://fabinm.com/content/view/17/9/> note that my opinions are based on the fact that i dont know how to create mysql stored procedure tru php and i seldom hav the access to mysql server. Kranthi. [Non-text portions of this message have been removed]