Mysql Update-Multiple Changes in one Query

I am allowing for the update of many entries to one row of my database in one mysql_query.
However I still want to be able to edit the entry that is serving as the reference. That is the cell that is unique between each row.

Below I populate the “old” variable into the text box, and I want the “equip” variable to be the contents of the text box when submitted, changed or unchanged.

This is my edit.php file where I retrieve entries and populate text boxes.
[php]

SystemsDoc Update <?php $db1=mysql_connect("ipaddress"); mysql_select_db("equipid"); $result=mysql_query("SELECT * FROM `machine` WHERE `Equip_ID` = '$equip'"); $row=mysql_fetch_array($result); $formVars = array(); $equip=$_POST['equip']; foreach($HTTP_POST_VARS as $varname => $value) $formVars[$varname]=$value; $formVars["mfg"]=$row["Mfg"]; $formVars["dept"]=$row["Department"]; $formVars["des"]=$row["Description"]; $formVars["equipnum"]=$row["EquipFile ID"]; $formVars["mfgs"]=$row["Mfg Serial Model ID"]; $formVars["old"]=$row["Equip_ID"]; mysql_close($db1); ?> Systems Doc Update [/php]
Department:
Mfg:
Equip ID:
Description:
EquipFile #:
Mfg Serial and/or Model #:

After edit.php is submitted I have postupdate.php

[php]

SystemsDoc Update <?php

$mfg=$_POST[‘mfg’];
$mfgs=$_POST[‘mfgs’];
$equip=$_POST[‘equip’];
$equipnum=$_POST[‘equipnum’];
$dept=$_POST[‘dept’];
$des=$_POST[‘des’];
$old=$_POST[‘old’]

echo $mfg;
echo $mfgs;
echo $equip;
echo $equipnum;
echo $dept;
echo $des;

$db1=mysql_connect(“192.168.0.225”);
mysql_select_db(“equipid”);

mysql_query(“UPDATE machine SET Mfg=’”.$mfg."’, Description=’".$des."’, EquipFile ID=’".$equipnum."’,Department=’".$dept."’,Mfg Serial Model ID=’".$mfgs."’,Equip_ID=’".$equip."’ WHERE Equip_ID=’".$old."’");
mysql_close($db1);
?>

[/php]

My multiple edits work as long as I dont edit the equipment/old entry.

Any suggestions would be much apprieciated!

Sponsor our Newsletter | Privacy Policy | Terms of Service