<?php

session_start();
require_once '../include/onlineStoreUser.php';
$onlineStore = new onlineStoreUseer();
if ($onlineStore->get_session()) {
    if ($onlineStore->check_admin_login()) {
        header("location: inventory_list.php");
        exit;
    }
}
//error report
$onlineStore->error_report();
?>

<?php 
//Gather this product full information for inserting automatically into the edit form below on page
if (isset($_GET['pid'])) {
    $targetID = $_GET['pid'];
    $product_list = "";
    $sql = mysql_query("SELECT * FROM products WHERE id = '{$targetID}' LIMIT 1");
    //ORDER BY $date_added DESC
    $productCount = mysql_num_rows($sql);
    //count the output amount
    //echo $productCount;
    //exit();
    if ($productCount > 0) {
        while ($row = mysql_fetch_array($sql)) {
            //$id = $row["id"];
            $product_name = $row["product_name"];
            $price = $row["price"];