Okay, here goes. Learning PHP and am having trouble building a program that would let a client insert inventory in the database without having any knowledge of MySQL or PHP.
Here is what I have so far:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Add A Piece To The Inventory!</title>
</head>
<body>
<form action="upload.php" method="post">
<input type="text" name="name" maxlength="60" />Name<br> <br>
<input type="text" name="category" maxlength="20" />Category<br> <br>
<input type="text" name="type" maxlength="20" />Type<br> <br>
<input type="text" name="description" maxlength="80" />Description<br> <br>
<input type="text" name="price" maxlength="10" />Price<br> <br>
<input type="submit" value="Upload New Item" />
</form>
</body>
</html>
Okay so that's what they are going to see and that works fine...now here's upload.php
<?php
$cxn = mysqli_connect ("localhost","orbit","******","storeinventory")
or die ("Could not connect"); ?>
<?php
$name = $_POST;
$category = $_POST;
$type = $_POST;
$description = $_POST;
$price = $_POST;
?>
<?php
$query = 'INSERT INTO `productlists` (`prod_number`, `name`, `category`, `type`, `description`, `price`, `pix`) VALUES (\'\', \'name\', \'category\', \'type\', \'description\', \'price\', \'\') WHERE (name="$name",category="$category",type="$type",description="$description",price="$price")';
$result = mysqli_query($cxn,$query)
or die("Couldn't execute query");
?>
<?php
echo "Hit the BACK button to insert another item"
?>
I get the "Couldn't execute query" everytime I try this. Please help. Yes, I know I missing something. Yes I have done something wrong. What is it though? I have tried for about 18 hours to figure this out.