trouble with deleting and editing mysql records

hi. may someone please tell me why though the code has no error, it does not edit or delete my data: below are the two codes for 2 linked pages:

$db = mysql_connect(“localhost”, “root”, “”);
mysql_select_db(“mydbms”,$db);
$result = mysql_query("SELECT sale_id, menu_item_name, quantity from menu_item_sale inner join menu_item on menu_item_sale.menu_item_id=menu_item.menu_item_id order by sale_id ",$db);
echo “

”;
echo""; while ($myrow = mysql_fetch_array($result)) { echo "
Sale Number Item Quantity Options
".$myrow["sale_id"]; echo " ".$myrow["menu_item_name"]; echo " ".$myrow["quantity"]; echo " View "; echo "Delete"; } echo "
"; ?>

// that is the page with the links. the code for viewing a specific record is:

<?php $db = mysql_connect("localhost", "root", ""); mysql_select_db("chmis",$db); $result = mysql_query("SELECT menu_item_name, selling_price, description, category_name FROM menu_item, tax_bracket, category WHERE menu_item_id='$menu_item_id' AND tax_bracket.tax_bracket_id=menu_item.tax_bracket_id AND category.category_id=menu_item.category_id",$db); $myrow = mysql_fetch_array($result); echo "Item Name: ".$myrow["menu_item_name"]; echo "
Selling Price: ".$myrow["sellng_price"]; echo "
Tax Bracket: ".$myrow["tax_bracket"]; echo "
Category: ".$myrow["category"]; ?>

You need to use DELETE and/or UPDATE queries

http://www.tizag.com/mysqlTutorial/mysqldelete.php

i used the code supplied by ibm.com/developerWorks which was:

<?php $db = mysql_connect("localhost", "root", ""); mysql_select_db("learndb",$db); mysql_query("DELETE FROM personnel WHERE id='$id'",$db); echo "Information Deleted"; ?>

i cannot find the one i wrote (i’m hard coding and i forgot to save it in plain text)

Sponsor our Newsletter | Privacy Policy | Terms of Service