我正在遵循此线程中给出的示例
为什么 insert 不起作用并且在 postresql 上不输出任何错误?
当我尝试使用此选项在数据库内插入多个值时;我遇到此错误“错误:“数组”第 2 行或附近的语法错误:VALUES 数组..”请问有什么帮助吗?下面是代码:
…….
"INSERT INTO people( mom, non, ooo)
VALUES
($1, $2, $3),
($4, $5, $6),
($7, $8, $9),
($10, $11, $12)
ON CONFLICT (mom) DO NOTHING";
$rcon = pg_query_params($connection, $ins,
Array(
[ $mom ,$non, $kooo],
[ $mom 1,$non1, $kooo1],
[ $mom 2,$non2, $kooo2],
[ $mom 3,$non3, $kooo3]
)
);
if(!$rcon){
echo pg_last_error($connection);
}else{
echo "Record added to database</br>"; //success confirmation
}
This gives this error; ERROR: bind message supplies 4 parameters, but prepared statement "" requires 12
phpPostgreSQLsql插入
墨色风雨
守候你守候我