I have a form that when submitted, the below happens. However, If there is already a User ID Number (UID) in the database (say the user decides to update their profile), I would like it to update the Privacy ID (PID) instead of inserting a new row with the same UID but the new PID. What would I put to update it but if a UID doesn't exist, to create it? Thanks in advance, this would be a major major help. [code] $link = mysql_connect("localhost","DATABASENAME","DATABASEPASSWORD"); mysql_select_db("TABLENAME",$link); $query="INSERT into TABLENAME (PID,UID) values ('".$PID."','".$UID."')"; mysql_query($query);[/code]