You do not need to check for a username / email / amount in the system. Just use $ num_rows1 to determine if you are updating an entry in the database - this will tell you if there was a match or not.
However, if the username, email, and amount are not enough to provide a unique record (i.e., it is likely that you will match more than one record in the database), this will not work. In this case, I would recommend finding a set of fields that together represent a unique key and ensure that you check them as part of the update.
source share