olaoyesunday Posted October 26, 2020 Share Posted October 26, 2020 Dear all, Please can anyone help, I am writing a code for updating one or all the 3 images in my product page but the query was not running, The below is the code I am trying to work on and I think is the line one that is causing the issue but I don't know what to do. if(is_uploaded_file($_FILES['file']['tmp_name'])){ // work for upload / update image $product_img1 = $_FILES['product_img1']['name']; $product_img2 = $_FILES['product_img2']['name']; $product_img3 = $_FILES['product_img3']['name']; $temp_name1 = $_FILES['product_img1']['tmp_name']; $temp_name2 = $_FILES['product_img2']['tmp_name']; $temp_name3 = $_FILES['product_img3']['tmp_name']; move_uploaded_file($temp_name1,"product_images/$product_img1"); move_uploaded_file($temp_name2,"product_images/$product_img2"); move_uploaded_file($temp_name3,"product_images/$product_img3"); $update_product = "update products set p_cat_id='$product_cat',cat_id='$cat',manufacturer_id='$manufacturer_id',date=NOW(),product_title='$product_title',product_url='$product_url',product_img1='$product_img1',product_img2='$product_img2',product_img3='$product_img3',product_price='$product_price',product_keywords='$product_keywords',product_desc='$product_desc',product_sale='$product_sale',product_label='$product_label',product_features='$product_features',product_video='$product_video' where product_id='$p_id'"; $run_product = mysqli_query($con,$update_product); if($run_product){ echo "<script>alert('Your product has been updated Successfully')</script>"; echo "<script>window.open('index.php?view_products','_self')</script>"; } }else{ Link to comment Share on other sites More sharing options...
Recommended Posts