<?php
// Connect to the MySQL database
include "../storescripts/connect_to_mysql.php";
exit();
?>
<?php
// Script Error Reporting
error_reporting(E_ALL);
ini_set('display_errors', '1');
?>
<?php
// Parse the form data and add inventory item to the system
if (isset($_POST['product_name'])) {
$pid = mysql_real_escape_string($_POST['thisID']);
$product_name = mysql_real_escape_string($_POST['product_name']);
$price = mysql_real_escape_string($_POST['price']);
$category = mysql_real_escape_string($_POST['category']);
$subcategory = mysql_real_escape_string($_POST['subcategory']);
$details = mysql_real_escape_string($_POST['details']);
$mtag = mysql_real_escape_string($_POST['mtag']);
// See if that product name is an identical match to another product in the system
$sql = mysql_query("UPDATE products SET product_name='$product_name', price='$price', details='$details', mtag='$mtag', category='$category', subcategory='$subcategory' WHERE id='$pid'");
if ($_FILES['fileField']['tmp_name'] != "") {
// Place image in the folder
$newname = "$pid.jpg";
move_uploaded_file($_FILES['fileField']['tmp_name'], "../inventory_images/$newname");
}
header("location: inventory_list.php");
exit();
}
?>
<?php
// Gather this product's full information for inserting automatically into the edit form below on page
if (isset($_GET['pid'])) {
$targetID = $_GET['pid'];
$sql = mysql_query("SELECT * FROM products WHERE id='$targetID' LIMIT 1");
$productCount = mysql_num_rows($sql); // count the output amount
if ($productCount > 0) {
while($row = mysql_fetch_array($sql)){
$product_name = $row["product_name"];
$price = $row["price"];
$category = $row["category"];
$subcategory = $row["subcategory"];
$details = $row["details"];
$mtag = $row["mtag"];
$date_added = strftime("%b %d, %Y", strtotime($row["date_added"]));
}
} else {
echo "Sorry dude that crap dont exist.";
exit();
}
}
?>
<?php
// This block grabs the whole list for viewing
$product_list = "";
$sql = mysql_query("SELECT * FROM products ORDER BY date_added DESC");
$productCount = mysql_num_rows($sql); // count the output amount
if ($productCount > 0) {
while($row = mysql_fetch_array($sql)){
$id = $row["id"];
$product_name = $row["product_name"];
$price = $row["price"];
$date_added = strftime("%b %d, %Y", strtotime($row["date_added"]));
$product_list .= "Product ID: $id -
$product_name - £$price -
Added $date_added edit •
delete";
}
} else {
$product_list = "You have no products listed in your store yet";
}
?>
Inventory List
<?php include_once("../template_header.php");?>
Inventory list
<?php echo $product_list; ?>
↓ Add New Inventory Item Form ↓
Product Name |
|
Product Price |
£
|
Category |
Clothing
|
Subcategory |
<?php echo $subcategory; ?>
Hats
Pants
Shirts
|
Product Details |
<?php echo $details; ?>
|
Product Image |
|
Meta Tag |
<?php echo $mtag; ?>
|
|
|
<?php include_once("../template_footer.php");?>
when i enter values inside my mtag in mysql they render back, but when i use the forum to upload to mysql doesnt work
please
please
please help
i know its something small im over looking but ive been over it and over it and can’t spot it