Hi again ! i am having an issue with updating database. When i update any price of a title it remove the title from database please can somebody help me what i am missing in my code. here it is:
<h3>Your Administration Center</h3> <?php // Connects to your Database db_connect();
//checks cookies to make sure they are logged in if(isset($_COOKIE['ID_my_site'])) { $username = $_COOKIE['ID_my_site']; $pass = $_COOKIE['Key_my_site']; $check = mysql_query("SELECT * FROM users WHERE username = '$username'")or die(mysql_error()); while($info = mysql_fetch_array( $check )) {
//if the cookie has the wrong password, they are taken to the login page if ($pass != $info['password']) { header("Location: login.php"); }
//otherwise they are shown the admin area else { ?> <?php //If cmd has not been initialized if(!isset($cmd)) { //displaying all products on the page with title and price $result = mysql_query("select * from booklist order by id"); echo'<center><h3>Product List</h3></center>'; //run the while loop that grabs all the news scripts while($r=mysql_fetch_array($result)) {
<? } ?> <?php if ($_POST["submit"]) { $title = $_POST["title"]; $body = $_POST["body"]; $price = $_POST["price"]; // Here i am having issue when i update it remove the title but update the price $sql = "UPDATE booklist SET title='$title',body='$body',price='$price' WHERE id=$id"; $result = mysql_query($sql); echo "<br /><center><font color="red">The Product Price Has been Updated. </font></center>"; } } echo'<center><h3>Orders List</h3></center>'; ?> <div style="border: 2px solid #FFFFFF; width: 700px; height: 260px; overflow: auto;"> <?php $orders = find_orders(); foreach($orders as $order): ?>