I have this code that does not do anything but add to my database and only adds the item ounces and retail price. any ideas on where i am going wrong?
--update.php---
<?php
session_start(); // start session cookies
require("Login.class.php"); // pull in file
$login = new Login; // create object login
$login->authorize(); // make user login
?>
<style type="text/css">
body {background-color:#42520e; color: #f0cb01;
}
th {background: URL(http://www.athenahealth.com/_img/boxes/carousel_bg.png);}
p {color:blue;}
a:link {color: #f0cb01; text-decoration: underline; }
a:active {color: #f0cb01; text-decoration: underline; }
a:visited {color: #f0cb01; text-decoration: underline; }
a:hover {color: #f0cb01; text-decoration: none; }
</style>
<?php
$retail=$_REQUEST['retail'];
$id=$_REQUEST['id'];
$name=$_REQUEST['name'];
$upc=$_REQUEST['upc'];
$ounces=$_REQUEST['ounces'];
define("HOST", "localhost");
$retail=$_REQUEST['retail'];
$id=$_REQUEST['id'];
$name=$_REQUEST['name'];
$upc=$_REQUEST['upc'];
$ounces=$_REQUEST['ounces'];
?>
Admin Panel to Update Keywords
<hr>
<table>
<tr><td valign="top"><br /><br />
<td>
Your are editing information for Product #: <b><? echo $_REQUEST['id']; ?></b>
<form method="post" action="update_ac.php">
<table> <tr><br /></tr>
<tr><td> Product #: </td><td> <input type="text" name="id" id="id" value="<? echo $_REQUEST['id']; ?>">* Enter Keyword as it currently appears<br></td></tr>
<tr><td> Name: </td><td><input type="text" name="name" id="name" value="<? echo $_REQUEST['name']; ?>">* Enter New Information<br></td></tr>
<tr><td> Suggested Retail:</td><td> <input type="text" name="retail" id="retail" value="<? echo $_REQUEST['retail']; ?>">* New Phone Number<br></td></tr>
<tr><td> Ounces: </td><td> <input type="text" name="ounces" id="ounces" value="<? echo $_REQUEST['ounces']; ?>">* Enter new block description here. <br></td></tr>
<tr><td> UPC: </td><td> <input type="text" name="upc" id="upc" value="<? echo $_REQUEST['upc']; ?>">* Enter new block description here. <br></td></tr>
<tr><td> </td><td align="left"> <input type="submit" name="submit" value="Submit Data"></td></tr>
</table>
</form>
</td></tr>
</table> <br />
<a href="index.php">Add Keyword</a> | <a href="../admin">Back to search form</a> |
<?php
echo '<pre>';
print($retail);
echo '</pre>';
?>
<a href="index.php?action=clear_login">logout</a>
</body>
and this is the update link that it uses and carries it over to the update_ac.php
<?php
session_start(); // start session cookies
require("Login.class.php"); // pull in file
$login = new Login; // create object login
$login->authorize(); // make user login
?>
<style type="text/css">
body {background-color:#42520e; color: #f0cb01;
}
th {background: URL(http://www.athenahealth.com/_img/boxes/carousel_bg.png);}
p {color:blue;}
a:link {color: #f0cb01; text-decoration: underline; }
a:active {color: #f0cb01; text-decoration: underline; }
a:visited {color: #f0cb01; text-decoration: underline; }
a:hover {color: #f0cb01; text-decoration: none; }
</style>
<?php
$retail=$_REQUEST['retail'];
$id=$_REQUEST['id'];
$name=$_REQUEST['name'];
$upc=$_REQUEST['upc'];
$ounces=$_REQUEST['ounces'];
define("HOST", "localhost");
$retail=$_REQUEST['retail'];
$id=$_REQUEST['id'];
$name=$_REQUEST['name'];
$upc=$_REQUEST['upc'];
$ounces=$_REQUEST['ounces'];
// Database user
define("DBUSER", "root");
// Database password
define("PASS", "Password!");
// Database name
define("DB", "SnyderLanceSku");
############## Make the mysql connection ###########
$conn = mysql_connect(HOST, DBUSER, PASS) or die('Could not connect !<br />Please contact the site\'s administrator.');
$db = mysql_select_db(DB) or die('Could not connect to database !<br />Please contact the site\'s administrator.');
mysql_query("UPDATE products SET UPC='$upc', Name='$name', Item_Ounces='$ounces' WHERE UPC='$upc' ") or die (mysql_error());
?>
<table>
<tr><td valign="top"><br /><br />
<td>
<table> <tr><b>Data Updated Successfully</b></tr>
<tr><td> Keyword: </td><td><? echo $id; ?><br></td></tr>
<tr><td> Block?: </td><td><? echo $name; ?><br></td></tr>
<tr><td> Phone #:</td><td><?php echo $upc; ?><br> </td></tr>
<tr><td> Reason: </td><td><? echo $retail; ?></td></tr>
<tr><td> Reason: </td><td><? echo $ounces; ?></td></tr>
</table>
</form>
</td></tr>
</table>
<a href="./">Go Back</a>
I'm not really sure where to look here... any help is appreciated.
EDIT:
Here is both scripts. It almost works correct. ONly thing now is it is not updating the correct row. its ADDING a new row instead of updating on id or in this case updating on UPC