More than likely, the query isn't built correctly as I am fairly green with SQL.
<?
$i=0;
foreach($AddedProducts as $AddedProduct)
{
$i++;
echo "<hr>" . $i . "<hr>";
$query='INSERT INTO products VALUES(';
foreach($AddedProduct as $key=>$value)
{
$query.=$value. (($key=='Cutsheet_Name')? ') ':', ');
echo $key . ' = ' . $value . (($key=='Picture_Name')? '.jpg<br>':'<br>');
}
$query .= 'ON DUPLICATE KEY UPDATE';
}
$statement = $db->prepare($query);
$statement->execute($query);
?>
Edit: Corrected Version in Progress
<?
$i=0;
foreach($AddedProducts as $AddedProduct)
{
$arr=Array();
$i++;
echo "<hr>" . $i . "<hr>";
foreach($AddedProduct as $key=>$value)
{
$arr[]=$value;
echo $key . ' = ' . $value . '<br>';
}
$query='INSERT INTO products VALUES(' . implode(', ', $arr) . ')';
$query .= ' ON DUPLICATE KEY UPDATE ';
foreach($AddedProduct as $key=>$value)
{
$query .= $key . '=' . $value . (($key !='Cutsheet_Name')? ', ':';');
}
$statement = $db->prepare($query);
$statement->execute($query);
}
?>