我需要使用 PHP 将数组中的值插入到我的数据库中。该数组有 40 个位置,每个位置都是我必须插入到数据库表中的值。
我需要一个快速的方法来写下来而不是写 $1,$2,$3 ... $39
我试过了:
$query = 'INSERT INTO table VALUES($1,$2, ..... $39)';
$result = pg_query_params($dbh, $s, $a[0]); //$a[0] array with 39 positions
但是写下来太长了。我还有一段代码,其中有 140 个职位。
呼啦一阵风