0) { echo 'Sorry you tried to place a duplicate "Product Name" into the system, click here'; exit(); } // Add this product into the database now $sql = mysql_query("INSERT INTO allproducts (product_name, price, details, category, subcategory, date_added) VALUES('$product_name','$price','$details','$category','$subcategory',now())") or die (mysql_error()); $pid = mysql_insert_id(); // Place image in the folder $newname = "$pid.jpg"; move_uploaded_file( $_FILES['fileField']['tmp_name'], "../inventory_images/$newname"); header("location: inventory_list.php"); exit(); } ?>