query("select max(id)+1 as id from webs.product"); $obj = $res->fetch_object(); $new_id = $obj->id; ?> prepare("insert into webs.product (`name`, `description`, `price`, `category`, `image`) values (?, ?, ?, ?, ?)"); $statement->bind_param("ssdii", $name, $description, $price, $category, $img); $statement->execute(); $data = file_get_contents($_FILES["img"]["tmp_name"]); $image = imagecreatefromstring($data); if (!$image) break; $full_path = "img/product/$new_id-full.jpg"; imagejpeg($image, $full_path); $thumb = imagescale($image, 250); $thumb_path = "img/product/$new_id-thumb.jpg"; imagejpeg($thumb, $thumb_path); } while (false); ?>