Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function add_product($connect) {
- $imgname1 = $_FILES["ft_img"]["name"];//How I will make this happen ?
- $imgtype1 = $_FILES["ft_img"]["type"];//How I will make this happen ?
- $imgtemp1 = $_FILES["ft_img"]["tmp_name"];//How I will make this happen ?
- $path1 = "./uploads/".$imgname1;
- $product_name = $_REQUEST["product_name"];
- $price = $_REQUEST['price'];
- $descrip = $_REQUEST["descrip"];
- move_uploaded_file($imgtemp1, $path1);
- $query_insert = "INSERT INTO products (user_id, product_name, product_price, description, prod_img) VALUES ('".$_SESSION['uid']."', '$product_name', '$price', '$descrip', '$imgname1')";
- $confirm = $connect->prepare($query_insert);
- $confirm->execute();
- if($confirm) {
- $response = 'Product added successfully';
- return $response;
- } else {
- $response = 'Product Not Added';
- return $response;_
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement