title: Edit data from Mysql using php
body: <p>I'm already displaying the MySQL data in a PHP table with a edit function, but I'm not able to edit them, and I don't know why.</p>
  
  <pre><code>&lt;?php
  require("db.php");
  $id =$_REQUEST['rid'];
  
  $result = mysql_query("SELECT * FROM replies WHERE rid = '$id'");
  $test = mysql_fetch_array($result);
  if (!$result) 
          {
          die("Error: Data not found..");
          }
                  $trigger1=$test['trigger1'] ;
                  $reply2= $test['reply2'] ;              
  
  if (isset($_POST['save']))
  {   
      $triggera = $_POST['trigger1'];
      $replyb = $_POST['reply2'];
  
      mysql_query("UPDATE `replies`(trigger,reply) VALUES ('$triggera','$replyb') WHERE rid = '$id'");  
      echo "Saved!";
  
  }
  mysql_close($conn);
  ?&gt;
  </code></pre>
  
  <p>And this is MySQL database code:</p>
  
  <pre><code>CREATE TABLE IF NOT EXISTS `replies` (
    `trigger` text NOT NULL,
    `reply` text NOT NULL,
    `usercontrib` tinyint(4) NOT NULL DEFAULT '0',
    `rid` int(10) unsigned NOT NULL
  ) ENGINE=MyISAM AUTO_INCREMENT=332 DEFAULT CHARSET=utf8;
  </code></pre>
  
  <p>and finally:</p>
  
  <pre><code>    &lt;form method="post"&gt;
          &lt;table&gt;
              &lt;tr&gt;
                  &lt;td&gt;Title:&lt;/td&gt;
                  &lt;td&gt;&lt;input type="text" name="trigger" value="&lt;?php echo $trigger1 ?&gt;"/&gt;&lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                  &lt;td&gt;Author&lt;/td&gt;
                  &lt;td&gt;&lt;input type="text" name="reply" value="&lt;?php echo $reply2 ?&gt;"/&gt;&lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                  &lt;td&gt;&amp;nbsp;&lt;/td&gt;
                  &lt;td&gt;&lt;input type="submit" name="save" value="save" /&gt;&lt;/td&gt;
              &lt;/tr&gt;
          &lt;/table&gt;
      &lt;/form&gt;
  </code></pre>
  
  <p>When I click "edit" in the specifically data to modify, the fields in the "edit" page are empty, I think the "echo" on thme is not function.</p>