Source code of dbUpdate2.php

<html>
<head>
<title>Updating information in a database</title>
</head>
<body>
<h2>Updating Prices</h2>
<form action='dbUpdate3.php' method='get'>
<?php

  
// Rather than listing my MySQL password directly in this PHP
  // page, I've stored it in an external file

  
$inv_id $_REQUEST['inv_id'];
  
$allLines file("mysql.txt");
  
$password trim($allLines[0]);
  
$dbLink mysql_connect("localhost""tboegel"$password);

  
mysql_select_db("clearwater"$dbLink);

  
$query "SELECT item_desc, inv_price, inv_id, color, inv_size "
    
"FROM inventory, item "
    
"WHERE inventory.item_id = item.item_id "
    
"AND inventory.inv_id = $inv_id "
    
"ORDER BY item_desc, color, inv_size";
  
$recordset mysql_query($query$dbLink);

  
$row mysql_fetch_assoc($recordset);

  print 
"<table>";
  print 
"<tr><td>Item:</td><td>{$row['item_desc']}</td></tr>\n";
  print 
"<tr><td>Color:</td><td>{$row['color']}</td></tr>\n";
  print 
"<tr><td>Size:</td><td>{$row['inv_size']}</td></tr>\n";
  print 
"<tr><td>Price:</td>";
  print 
"<td><input type='text' name='newprice' size=8 "
    
"value='" $row['inv_price'] . "'></td></tr>\n";
  print 
"</table>";

  
mysql_free_result($recordset);

  
mysql_close($dbLink);

  print 
"<input type='hidden' name='inv_id' value='$inv_id'>";

?>
<input type='submit' value='Update Price'>
</form>
</body>
</html>