You assign $pro to the prepare command, not execute.
Having said that, if you are using mysql, you can use the insert... on duplicate key update syntax.
insert into $table (field, value) values (:name, :value) on duplicate key update value=:value2
You cannot use the same related parameter twice, but you can set two related parameters to the same value.
Edit: this mysql syntax will only work where the key is present (primary or other unique) and will cause the insert to fail.
source share