query($Query_last_invoice); //$noo=mysql_num_rows($name_last_invoice); $tablename = "shop_product"; /* '".trim( $_REQUEST['job_code'] )."','".$new_job_name."','".$des."','".trim( $_REQUEST['job_priority'] )."','".$job_po_no."','".trim( $_REQUEST['pricing'] )."','".trim( $_REQUEST['job_type'] )."','','".$est_time_new."','".$date."','".trim( $_REQUEST['user_type'] )."','','', '".trim( $clientemail )."','','','','','','','','','','','','','','','','','','','','','','','1','','','','','','',''*/ $Query="INSERT INTO $tablename VALUES (NULL,'".trim($product_name)."','".$sp_ins."','".$job_description."','$used_for','$dosage','$one_line','','','','$ean','','','','','$sell_price','$weight','','".$category."','0','".$price."','".$int_price."','".$disease."','0','1','1','1','1','1','0','0','0','0','0','0','".$company."','0000-00-00 00:00:00','0000-00-00 00:00:00','0','".$sell_price."','vie','0')"; $DB->query($Query); $mysql_insert_id= mysql_insert_id(); if($_FILES['mast']['name']!="") { $size = 190; // the thumbnail height $filedir = '../../default/s-img/'; // the directory for the original image $thumbdir = '../../default/s-img/'; // the directory for the thumbnail image $maxfile = '200000000000'; $mode = '0666'; echo $userfile_name = $_FILES['mast']['name']; $userfile_tmp = $_FILES['mast']['tmp_name']; //$userfile_name = $_FILES['uploadFile']['name']; //$userfile_tmp = $_FILES['uploadFile']['tmp_name']; $getExt = explode ('.', $userfile_name); $rand_name = md5(rand(000,999)); /* $prod_img = $filedir.$mysql_insert_id.$i.$getExt[0].".".$getExt[1];*/ $new_file_name = $userfile_name; //exit(); $new_file_name = str_replace('&','and',$new_file_name); $new_file_name = str_replace('#','',$new_file_name); $new_file_name = str_replace('+','',$new_file_name); $new_file_name = str_replace("'", '', $new_file_name); $new_file_name = str_replace(' ','',$new_file_name); $new_file_name_3730=$new_file_name; $new_file_name=($mysql_insert_id.$new_file_name); $prod_img = $filedir.$new_file_name; // original_images/456546565465465464jhh.jpg $items[] = $prod_img; $prod_img_thumb = $thumbdir.$getExt[0].".".$getExt[1]; move_uploaded_file($userfile_tmp, $prod_img); $upload_img = "UPDATE shop_product SET image='".$new_file_name."' WHERE product_id='".$mysql_insert_id."'"; $DB->query($upload_img); // $upload_img = mysql_query("UPDATE shop_product SET image='".$new_file_name."' WHERE id='".$mysql_insert_id."'"); } $total_file=count($_POST['para']); foreach($_POST["para"] as $key=>$tmp_name) { if($_POST['para'][$key]!="") { $size = 190; // the thumbnail height $filedir = '../../default/f-img/'; // the directory for the original image $thumbdir = '../../default/f-img/'; // the directory for the thumbnail image $maxfile = '200000000000'; $mode = '0666'; $userfile_name_3730 = $_POST['para'][$key]; $userfile_name = $_POST['para'][$key]; $userfile_tmp = $_POST['para'][$key]; //$userfile_name = $_FILES['uploadFile']['name']; //$userfile_tmp = $_FILES['uploadFile']['tmp_name']; $getExt = explode ('.', $userfile_name); $rand_name = md5(rand(000,999)); /* $prod_img = $filedir.$mysql_insert_id.$i.$getExt[0].".".$getExt[1];*/ $new_file_name = $userfile_name; //exit(); $new_file_name = str_replace('&','and',$new_file_name); $new_file_name = str_replace('#','',$new_file_name); $new_file_name = str_replace('+','',$new_file_name); $new_file_name = str_replace("'", '', $new_file_name); $new_file_name = str_replace(' ','',$new_file_name); $new_file_name_3730=$new_file_name; $userfile_name_3730=$new_file_name; $Query_pay_date = "SELECT image from shop_product_image where image='$new_file_name'"; $name_pay_date=$DB->query($Query_pay_date); $n_pay_date=mysql_num_rows($name_pay_date); if($n_pay_date>0) { $Query_pay_date_new = "SELECT new_name from tbl_job_img where old_name='$userfile_name_3730'"; $name_pay_date_new=$DB->query($Query_pay_date_new); $row_12_123=mysql_fetch_array($name_pay_date_new); $mysql_insert_id_3730=$row_12_123['new_name']; $new_file_name=($mysql_insert_id_3730); } //$new_width=200; //$new_height=150; $tablename1="shop_product_image"; $Query="INSERT INTO $tablename1 VALUES (NULL,'".$mysql_insert_id."','".trim( addslashes($new_file_name) )."','0')"; $DB->query($Query); if($n_pay_date>0) { $Query_delete = "DELETE from tbl_job_img where old_name='$userfile_name_3730'"; $name_delete=$DB->query($Query_delete); } //echo ("INSERT INTO gallery(img_thumb,org_img) VALUES ('".$prod_img_thumb."','".$prod_img."')"); //$upload_img = mysql_query("UPDATE products SET img_thumb='".$prod_img_thumb."', org_img='".$prod_img."' WHERE id='".$_GET['id']."'"); } } } } ?>
Success! Data Added Sucessfully.
Danger! Already Exists.

Product

'; echo''; } else { echo''; } ?>