I make shopping site in php and I have one issue of product data.
First I make **product** datatabe below.
CREATE TABLE IF NOT EXISTS `product` (
`product_id` int(11) NOT NULL AUTO_INCREMENT,
`product_sales_id` int(11) NOT NULL,
`product_name` varchar(100) NOT NULL,
`product_price` varchar(5000) NOT NULL,
`image_name` varchar(300) NOT NULL,
PRIMARY KEY (`product_id`)
)
And Second table **product sales** below :
CREATE TABLE IF NOT EXISTS `product_sales` (
`product_sales_id` int(11) NOT NULL,
)
Below page it admin site page when select product to insert in database and
show in product page.
Add_Product.php :
<?php
include_once('include/connection.php');
include_once('include/function.php');
?>
<?php
if(isset($_POST['submit'])){
$product_name = mysqli_real_escape_string($conn,$_POST['product_name']);
$product_price = mysqli_real_escape_string($conn,$_POST['product_price']);
$image_name = mysqli_real_escape_string($conn, basename( $_FILES["product_image"]["name"]));
$target_dir = "upload/";
$target_file = $target_dir . basename($_FILES["product_image"]["name"]);
$uploadOk = 1;
$imageFileType = pathinfo($target_file,PATHINFO_EXTENSION);
$filetype = $_FILES["product_image"]["type"];
$image_upload = move_uploaded_file($_FILES["product_image"]["tmp_name"], $target_file);
if($image_upload){
mysqli_query($conn,"INSERT INTO product(product_name,product_price,image_name) VALUES ('".$product_name."','".$product_price."','".$image_name."')");
}
}
?>
I make on more page product sell page but i do not know how to make this Above show I make table product_sales and his id store in product table how to add product_sales in database and show in page using id through.