<?php
require_once('mysqli_con.php');
session_start();
$name = $_POST["iname"];
$sz = $_POST["size"];
$cat = $_POST["category"];
$p = $_POST["price"];
$inf = $_POST["info"];
$sc = $_POST["scategory"];
$imgData =addslashes(file_get_contents($_FILES['image']['tmp_name']));
$buyerid = $_SESSION['byrID'];
$statusItm = "AVAILABLE";
$dataTime = date ("Y-m-d H:i:s");

$sql = "INSERT INTO items (itemCode,items_name,items_info, category, price, size_items, sub_category, image,created, buyer_id,status)
VALUES ('$name.$buyerid','$name','$inf','$cat','$p','$sz','$sc','$imgData', '$dataTime','$buyerid','$statusItm')";

if (mysqli_query($conn, $sql)){
  echo "File uploaded successfully. ";
  ?>
  <meta http-equiv="refresh" content="100;URL=sellitems.php" />
  <?php
}else{
  echo "File uploaded failed :" . mysqli_error($conn);
  ?>
  <meta http-equiv="refresh" content="100;URL=sellitems.php" />
  <?php
}

 ?>
