当我尝试向我的PSQL DB插入内容时,我收到此错误:
SQLSTATE [42601]:语法错误:7错误:INSERT有更多表达式 比目标列LINE 1:... acturer,model,submodel)VALUES($ 1, $ 2,$ 3,$ 4,$ 4,$ 5,$ 6)^
我的查询显示在下面,以避免它的某种数据问题我只是插入数字字符串。所以这看起来真的很适合我。
查询:
public function insertToPsql($manufacturer_code, $main_type, $subtype_code, $manufacturer, $model, $submodel)
{
try {
//$con = new PDO( PSQL_DB_HOST, PSQL_DB_HOST, PSQL_DB_HOST );
$con = new PDO("pgsql:dbname=audahistory;host=localhost", "postgres", "");
$con->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );
$sql = "INSERT INTO car_type(manufacturer_code, main_type, subtype_code, manufacturer, model, submodel) VALUES(:manufacturer_code, :main_type, :subtype_code, :manufacturer, :model, :submodel)";
$stmt = $con->prepare( $sql );
$stmt->bindValue( 'manufacturer_code', "1", PDO::PARAM_STR );
$stmt->bindValue( 'main_type', "2", PDO::PARAM_STR );
$stmt->bindValue( 'subtype_code', "3", PDO::PARAM_STR );
$stmt->bindValue( 'manufacturer', "4", PDO::PARAM_STR );
$stmt->bindValue( 'model', "5", PDO::PARAM_STR );
$stmt->bindValue( 'submodel', "6", PDO::PARAM_STR );
$stmt->execute();
}
catch( PDOException $e ) {
echo $e->getMessage();
exit;
}
}
知道哪里有问题? 谢谢你的建议