$RS = $Conn->Execute("SELECT * FROM affiliate where Affiliate_Number=".$an); if(! $RS->BOF ) #Beginning of file, as in returned no records { $RS -> movelast; $RS -> movefirst; $RS -> Recordcount; #This may be a nitpick point, but MoveLast, MoveFirst, #and RecordCount are all case sensitive. $sql="update affiliate set Affiliate_Refferals=Affiliate_Refferals+1 where Affiliate_Number=".$an; }else{ &error('bad_affiliate_number'); #I don't know what you are trying to do with this, but hey. }