Good afternoon as you can see in the title, I want that at the time of entering the data to the bd of postgresql first verify that the "doc" exists, if there is an update and if there is no do an insert into , I tried and reading in forums examples but I did not leave, here I leave my code in php:
public function InsertarHuesped( $tpcli, $pais, $doctp, $doc, $docexp, $name, $lastname, $email, $phone, $address)
{
$Conexion = $this->Bd->connect();
$ResultSet = $Conexion->prepare("INSERT INTO cliente1 (tpcli, country, doctp, doc, docexp, name, lastname, email, phone, address) VALUES (:tpcli, :country, :doctp, :doc, :docexp, :name, :lastname, :email, :phone, :address)");
$ResultSet->execute(array(
"tpcli" => "$tpcli",
"country" => "$pais",
"doctp" => "$doctp",
"doc" => "$doc",
"docexp" => "$docexp",
"name" => "$name",
"lastname" => "$lastname",
"email" => "$email",
"phone" => "$phone",
"address" => $address
));
return $ResultSet;
}
Thank you very much for helping me share a bit of your knowledge, good morning.