I\'m trying to insert in array that looks like:
$prices = array(array(\'event_id\' => 1, \'event_price_type\' => 5, \'event_price\' => 5, \'event_price
As Phantom said in his answer, You have a typo. There isevent_price_currency
key in your array and :event_price_currency_id
placeholder in prepare() statement. If fixing that doesn't work, try the following code and check the typo. Let me know if you face any problem.
try
{
$DBH->beginTransaction();
$STH = $DBH->prepare("INSERT INTO event_prices(event_id, event_price_type, event_price, event_price_currency_id, event_price_info ) values (?, ?, ?, ?, ?)");
foreach($prices as $price)
{
foreach($price as $row)
{
$data[] = $row;
}
$STH->execute($data);
$data = NULL;
}
$DBH->commit();
}
catch(PDOException $e)
{
echo 'Error ! ' . $e->getMessage();
die();
}