POSTGRESQL INSERT if specific row name don't exists !
问题 I'm trying to INSERT in my Postgresql database only if my model don't exists. I'm using PDO connection, I try IGNORE and ON DUPLICATE KEY UPDATE but with errors in PDO / syntax. MY Code: if(isset($_POST['insertModel'])){ require("includes/connection.php"); $models = $_POST['name']; $parametros = array($models); $sth = $dbh->prepare("INSERT INTO models (name) VALUES ( ? )"); $sth->execute($parametros); if($sth){ header("location: admin.php?model_inserted=1"); } } Thanks 回答1: ON DUPLICATE KEY