Jump to content

modify product


karthikanov24

Recommended Posts

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  ?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.