Witam mam problem nie umiem zrobić odświeżania listy zawodników po dodaniu kordu bad jego aktualizacji.
Samo dodawanie i aktualizacje mam żeby odświeżyć listę to mam problem. Proszę o pomoc.

Lista zawodników z form i dodawanie gracza
  1. <!--c1--><div class='codetop'>Kod</div><div class='codemain'><!--ec1--><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  2. <script type="text/javascript" src="mintAjax.js"></script>
  3.  
  4. <script type="text/javascript">
  5. function SendRequest(formik)
  6.         {                                  
  7.          var req = mint.Request();  
  8.                                             
  9.             req.OnAbort =  function()
  10.              {
  11.               alert("Serwer ma problemy z odebraniem zapytania. Spróbuj ponownie późnej.");
  12.              }
  13.                req.OnLoading = function()
  14.                    {
  15.                      $("response").style.display = "block";
  16.                      $("response").innerHTML = "<img src=\'loader.gif\'>";
  17.                    }
  18.                      req.OnSuccess = function(){
  19.                      $("response").innerHTML = this.responseText;
  20.                      }
  21.                      req.SendForm(formik);
  22.                      }
  23.               </script>
  24.  
  25.  
  26. <?php
  27. ini_set('display_errors','1');
  28. define('DB_HOST','localhost');
  29. define('DB_NAME','tester');
  30. define('DB_USER','root');
  31. define('DB_PASS','');
  32. require_once('./mysqlclass.php');//Lib od bazy
  33. $db = new sqlcon();//Zalączanie obiektu
  34.  
  35. add_player($db);
  36. echo '<br /><div id="response"></div><br />';
  37. players_list($db);
  38.  
  39.  
  40. function add_player($db)
  41.    {
  42.    echo'<table width="400">
  43.    <form id="form_add" method="POST" action="update.php?mode=2">
  44.              <tr>
  45.              <td>Nr zawodnika:</td>
  46.              </tr>
  47.              <tr>
  48.              <td><input type="text" name="nr" size="5" value="" /></td>
  49.              </tr>
  50.              <tr>
  51.              <td>Imię i Nazwisko:</td>
  52.              </tr>
  53.              <tr>
  54.              <td><input type="text" name="name" size="40" value="" /></td>
  55.              </tr>
  56.              <tr>
  57.              </form>
  58.             
  59.             <td><button onclick="SendRequest(form_add)">Zapisz</button></td>
  60.              </tr></table>';
  61.   
  62.    }
  63.  
  64.  
  65. function players_list(sqlcon $db)
  66.     {
  67.   
  68.      echo'
  69.      <table><tr><td>Nr</td><td>Imię i Nazwisko</td><td>Akcja</td></tr>';
  70.     
  71.      $query = $db->query("SELECT * FROM players ORDER by nr asc");
  72.       while($row = $db->fetch_assoc($query))
  73.           {
  74.       
  75.        echo '
  76.              <form id="form'.$row['id'].'" method="POST" action="update.php?mode=1">
  77.              <tr>
  78.              <td><input type="text" name="nr" size="5" value="'.$row['nr'].'" /></td>
  79.              <input type="hidden" name="id" value="'.$row['id'].'"/>
  80.              <td><input type="text" name="name" size="40" value="'.$row['player_name'].'" /></td>
  81.              </form><td><button onclick="SendRequest(form'.$row['id'].')">Zapisz</button></td>
  82.              </tr>';
  83.              }
  84. echo' </table>';
  85. }<!--c2--></div><!--ec2-->



update.php

  1. <!--c1--><div class='codetop'>Kod</div><div class='codemain'><!--ec1--><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  2.  
  3. <?php
  4. define('DB_HOST','localhost');
  5. define('DB_NAME','tester');
  6. define('DB_USER','root');
  7. define('DB_PASS','');
  8. require_once('./mysqlclass.php');//Lib od bazy
  9. $db = new sqlcon();//Zalączanie obiektu
  10.  
  11.  
  12. if(!isset($_GET['mode']) OR (isset($_GET['mode']) && $_GET['mode'] == '1'))
  13. {
  14.   $mode  = "UPDATE players SET";
  15.   $mode2 = "WHERE id = '".$_POST['id']."'";
  16.   $numer =  'o numerze '.$_POST['nr'].'';
  17.   }
  18. elseif(isset($_GET['mode']) && $_GET['mode'] == '2')
  19. {
  20.   $mode  = "INSERT INTO players SET";
  21.   $mode2 = "";
  22.   $numer = '';
  23. }
  24.  
  25.  
  26. if(empty($_POST['name']))
  27.     {
  28. echo 'Prosimy podać Imię i Nazwisko zawodnika '.$numer.'';
  29.     }
  30.  
  31. elseif(empty($_POST['nr']))
  32.     {
  33.     echo'Prosimy o podanie numeru zawodnika';
  34.     }
  35.  
  36. else
  37.     {
  38.     $db->query("".$mode." player_name = '".$_POST['name']."' ,nr = ".intval($_POST['nr'])."  ".$mode2." ");
  39.  
  40.  
  41. if(!isset($_GET['mode']) OR (isset($_GET['mode']) && $_GET['mode'] == '1'))
  42.         {
  43.     echo'Zawodnik z numerem '.intval($_POST['nr']).' został uaktualniony';
  44.         }
  45.        elseif(isset($_GET['mode']) && $_GET['mode'] == '2')
  46.         {
  47.     echo'Zawodnik z numerem '.intval($_POST['nr']).' został dodany';
  48.         }
  49.     
  50.     
  51.     
  52.     }
  53. ?><!--c2--></div><!--ec2-->