In message <710827.54108.qm@xxxxxxxxxxxxxxxxxxxxxxx>, Anees <anees_muhd@xxxxxxxxx> writes >HI Pete, > >Thanks for ur help >But , still der is a chance to not get the image, >Imagine, If admin(he manages the site) deleted the Record with image Id 55 and >runs ur query with Rand()*10 returns 5 when MAX(image Id) gives 60 $result=0; while !$result { do the query $result=number of records returned } -- Pete Clark Sunny Andalucia http://hotcosta.com/Andalucia.Spain