2017-01-29 4 views
-2

PHPページのグリッドテーブルを使用して現在表示されているMySQLテーブルがあります。MySQLのデータごとにPHPページのグリッドを更新するには

  1. ここで、PHPに表示されるレコードの特定のフィールドが変更されています。
  2. 新しいレコードがテーブルに追加されるたびに。
  3. レコードがMySQLテーブルで削除されると、グリッドテーブルの行が削除されます。

答えて

0

フィールドを更新するためにステップ法バイステップ:返信先生のための

 //First the user will specify what field to Update 

     <form method="post"> 
      <p>Field to Update: 
      <input type="text" name="pupdate"></p> 

     //Next the user will update the field 
      <p>Updated Name: 
      <input type="text" name="pname"></p> 
      <p><input type="submit" value="Add New"/></p> 
     </form> 

     <?php 

     //To connect to database(If you dont understand the next line I can explain it further) 
     require_once "db.php"; 

     if (isset($_POST['pupdate']) && isset($_POST['pname'])) 
     { 
      $up = $_POST['pupdate']; 
      $u = $_POST['pname']; 

     //This will update the database with the new field 
     $sql = "UPDATE NAMEOFTABLE 
      SET pname='$u' 
      WHERE pname='$up'"; 

     echo "<pre>\n$sql\n</pre>\n"; 

     mysql_query($sql); 
     } 
     ?> 
+0

おかげで、私はこれは私が要求したものではないと思います。私は、PHPグリッドに表示されたデータを、データベースに変更があるたびに更新したい – Raky

関連する問題