我正在尝试向$size
表中注入一些值,但无法识别其中一列。
php代码:
SQL
$db = get_PDO();
for ($i = 0; $i < count($names); $i++) {
$sql = "INSERT INTO presidents(name, year, vice_president) "
. "VALUES (:name, :year, :vice_president);";
$stmt = $db->prepare($sql);
$params = array("name" => $names[$i],
"year" => $year[$i],
"vice_president" => $vice_president[$i],);
$stmt->execute($params);
}
,$names
和$year
是数组
sql代码:
$vice_president
我收到此错误:
致命错误:未捕获PDOException:SQLSTATE [42S22]:找不到列:1054“字段列表”中的未知列“ vice_president”