I didn't know that my versin of mysql 4.0 didn't support control structure. And all this time I though it was just an syntax error. Are you referring to the REPLACE solution that you gave me. It works find, but I also need to "Select * from table1 where pk_ID = LAST_INSERT_ID();" if it is a new record. If it is an existing record I would like to "Select * from table1 where pk_ID = (the id that was updated). If there is an solution for this please let me know.