Advertisement
Guest User

Untitled

a guest
Jan 17th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. function add_product($connect) {
  2.  
  3. $imgname1 = $_FILES["ft_img"]["name"];//How I will make this happen ?
  4. $imgtype1 = $_FILES["ft_img"]["type"];//How I will make this happen ?
  5. $imgtemp1 = $_FILES["ft_img"]["tmp_name"];//How I will make this happen ?
  6.  
  7. $path1 = "./uploads/".$imgname1;
  8.  
  9. $product_name = $_REQUEST["product_name"];
  10. $price = $_REQUEST['price'];
  11. $descrip = $_REQUEST["descrip"];
  12. move_uploaded_file($imgtemp1, $path1);
  13.  
  14.  
  15. $query_insert = "INSERT INTO products (user_id, product_name, product_price, description, prod_img) VALUES ('".$_SESSION['uid']."', '$product_name', '$price', '$descrip', '$imgname1')";
  16. $confirm = $connect->prepare($query_insert);
  17. $confirm->execute();
  18.  
  19. if($confirm) {
  20. $response = 'Product added successfully';
  21. return $response;
  22. } else {
  23. $response = 'Product Not Added';
  24. return $response;_
  25. }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement