title: Can't Display Record Field Update Result in MySQL PHP Form
body: <p>After pressing "Update" button, It should update and then to display the result of an updated record record (a single updated record with selected columns). However, the page only displays table column names without any records and a few errors. Please help.</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;strong&gt;&lt;font size="6"&gt;Sales Log - Main&lt;/font&gt;&lt;font size="5"&gt;&lt;br /&gt;
  (Transaction Status Update)&lt;/font&gt;&lt;/strong&gt;
  &lt;/head&gt;
  &lt;body bgcolor="#6E6E6E" text="Azure"&gt;
  
  &lt;?php
  if(isset($_POST['update']))
  {
  $dbhost = 'localhost';
  $dbuser = 'jack';
  $dbpass = 'somepassword';
  $myDBname = 'sales';
  $conn = mysql_connect($dbhost, $dbuser, $dbpass, $myDBname);
  if(! $conn )
  {
    die('Could not connect: ' . mysql_error());
  }
  
  $FileNumber = mysql_real_escape_string($_POST['FileNumber']);
  $Status = mysql_real_escape_string($_POST['Status']);
  
  //$sql = "UPDATE saleslog SET Status = '".$Status."' WHERE FileNumber = '".$FileNumber."'"; //this worked fine then code below was introduced
  
  $sql = "UPDATE saleslog 
         SET Status = '$Status'
         WHERE FileNumber = '$FileNumber'" ;
  
  mysql_select_db('realestate');
  $retval = mysql_query( $sql, $conn );
  if(! $retval )
  {
    die('Could not update data: ' . mysql_error());
  }
  echo "Updated data successfully!\n";
  mysql_close($conn);
  }
  else
  {
  ?&gt;
  &lt;form method="post" action="&lt;?php $_PHP_SELF ?&gt;"&gt;
  &lt;table width="400" border="0" cellspacing="1" cellpadding="2"&gt;
  &lt;tr&gt;
  &lt;br /&gt;
  &lt;br /&gt;
  &lt;td width="100"&gt;File Number&lt;/td&gt;
  &lt;td&gt;&lt;input name="FileNumber" type="text" id="FileNumber"&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td width="100"&gt;Status&lt;/td&gt;
  &lt;td&gt;&lt;input name="Status" type="text" id="Status" value="Closed"&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td width="100"&gt; &lt;/td&gt;
  &lt;td&gt; &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td width="100"&gt; &lt;/td&gt;
  &lt;td&gt;
  &lt;input name="update" type="submit" id="update" value="Update"&gt;
  &lt;input name="reset" type="reset" onclick="resetForm(''); return false;" /&gt;
  &lt;/td&gt;
  &lt;/tr&gt;
  &lt;/table&gt;
  &lt;/form&gt;
  &lt;?php
  }
  ?&gt;
  
  
  $sql="SELECT FileNumber, Address, Status FROM $tbl_name";
  $result=mysql_query($sql);
  ?&gt;
  
  &lt;table width="400" border="0" cellspacing="1" cellpadding="0"&gt;
  &lt;tr&gt;
  &lt;td&gt;
  &lt;table width="400" border="1" cellspacing="0" cellpadding="3"&gt;
  &lt;tr&gt;
  &lt;td colspan="4"&gt;&lt;strong&gt;List data from mysql &lt;/strong&gt; &lt;/td&gt;
  &lt;/tr&gt;
  
  &lt;tr&gt;
  &lt;td align="center"&gt;&lt;strong&gt;FileNumber&lt;/strong&gt;&lt;/td&gt;
  &lt;td align="center"&gt;&lt;strong&gt;Address&lt;/strong&gt;&lt;/td&gt;
  &lt;td align="center"&gt;&lt;strong&gt;Status&lt;/strong&gt;&lt;/td&gt;
  &lt;/tr&gt;
  
  &lt;?php
  while($rows=mysql_fetch_array($result)){
  ?&gt;
  
  &lt;tr&gt;
  &lt;td&gt;&lt;? echo $rows['FileNumber']; ?&gt;&lt;/td&gt;
  &lt;td&gt;&lt;? echo $rows['Address']; ?&gt;&lt;/td&gt;
  &lt;td&gt;&lt;? echo $rows['Status']; ?&gt;&lt;/td&gt;
  
  &lt;/tr&gt;
  
  &lt;?php
  }
  ?&gt;
  
  &lt;/table&gt;
  &lt;/td&gt;
  &lt;/tr&gt;
  &lt;/table&gt;
  
  &lt;?php
  mysql_close();
  ?&gt;
  </code></pre>
  
  <p>
  </p>