so instead of it looking like this:
Code: Select all
if (isset($data['product_image'])) {
foreach ($data['product_image'] as $image) {
$this->db->query("INSERT INTO " . DB_PREFIX . "product_image SET product_id = '" . (int)$product_id . "', image = '" . $this->db->escape($image) . "'");
}
}

Code: Select all
if (isset($data['product_image'])) {
foreach ($data['product_image'] as $image) {
$image = $image.".jpg";
$image = str_replace (" ", "", $image);
$filename='%2Fhome%2Fpurchase%2Fpublic_html%2Ffancydresscostumesonline%26%2346%3Bco%26%2346%3Buk%2Fimage%2F'. $image;
if (file_exists($filename)) {
$this->db->query("INSERT INTO " . DB_PREFIX . "product_image SET product_id = '" . (int)$product_id . "', image = '" . $this->db->escape($image) . "'");
} else {
$this->db->query("INSERT INTO " . DB_PREFIX . "product_image SET product_id = '" . (int)$product_id . "', image = 'no_image.jpg'");
}
}
}
Regards,
Aaron