hi
In the following function, to modify a product in a shopping cart,
function modifyProduct()
{
$productId = (int)$_GET['productId'];
$catId = $_POST['cboCategory'];
$name = $_POST['txtName'];
$description = $_POST['mtxDescription'];
$price = str_replace(',', '', $_POST['txtPrice']);
$qty = $_POST['txtQty'];
$images = uploadProductImage('fleImage', SRV_ROOT . 'images/product/');
$mainImage = $images['image'];
$thumbnail = $images['thumbnail'];
//echo $thumbnail;
// if uploading a new image
// remove old image
if ($mainImage != '') {
_deleteImage($productId);
$mainImage = "'$mainImage'";
$thumbnail = "'$thumbnail'";
} else {
// if we're not updating the image
// make sure the old path remain the same
// in the database
$mainImage = 'pd_image';
$thumbnail = 'pd_thumbnail';
}
$sql = "UPDATE tbl_product
SET cat_id = $catId, pd_name = '$name', pd_description = '$description', pd_price = $price,
pd_qty = $qty, pd_image = $mainImage, pd_thumbnail = $thumbnail
WHERE pd_id = $productId";
$result = dbQuery($sql);
header('Location: index.php');
}
At the following lines of code,
$mainImage = "'$mainImage'";
$thumbnail = "'$thumbnail'";
why $mainimage is inside double quotes ?