PHP ...将查询刷新到表中

时间:2017-06-28 09:11:29

标签: php mysqli refresh

我的代码有问题(xampp一切都好,但在服务器上没有!!!):当我返回“registtab.php”时,表格没有更新:

  1. 在这个页面(registtab.php)中,我看到一个包含记录的表;这里好一切
  2. 点击按钮输入新记录,将我重定向到页面(registnew.php),输入数据,保存并重定向到“registrtab.php”<<如果我去phpmyadmin,则插入记录> >
  3. 现在我发现自己在页面(registtab.php),但表查询没有更新,为什么???因为xampp工作而且在服务器上没有!!! ......
  4. 谢谢

    <?php
    if(!session_id()) {@session_start();}
    require_once('x_mycode.php');
    if(isset($_POST['call_New_Regist'])){xcall_New_Regist();};
    if(isset($_POST['xRadioR']) and isset($_POST['call_Mod_Regist'])){xcall_Mod_Regist();};
    
    function xcall_New_Regist(){
      echo "<script>window.open('registnew.php','_self')</script>";
    }
    
    function xcall_Mod_Regist(){
      $db = new Db();
      $nRadio = $db -> quote($_POST['xRadioR']);
      $result = $db -> query("select xIdR, xNome from xRegistr where xIdR ='".$_POST['xRadioR']."'") -> fetch_row();
      $_SESSION['nRegisId'] = $result[0];
      echo "<script>window.open('registmod.php','_self')</script>";
    }
    ?>
    
    
    <!DOCTYPE html>
    <html lang='it'>
    <head>
    <?php
      $Head = new xHead();
      $Head -> xTitle('WebApp'); $Head -> xMeta();
      $Head -> xBootstrap_CSS();
      $Head -> xBootstrap_Theme_CSS(); $Head -> xJQuery_JS(); $Head -> xBootstrap_JS();
      $Head -> xHTML5_IE(); $Head -> xAngular_JS();
    ?>
    </head>
    
    <body>
      <!-- barra di navigazione -->
    
      <!-- TABLE SCROLL -->
      <style type="text/css">
         table {width: 100%;}
         thead, tbody, tr, td, th {display: block;}
         tr:after {content: ' '; display: block; visibility: hidden; clear: both;}
         thead th {height: 30px; /*text-align: left;*/}
         tbody {height: 350px; overflow-y: auto;}
         thead {/* fallback */}
         tbody td, thead th {width: 25%; float: left;}
      </style>
      <!-- pannello completo -->
      <?php
         $db = new Db();
         $result = $db -> query("select xIdR, xTipo, xNome, from xRegistr");
      ?>
      <div class="container" style='padding-top: 70px;'> <div class="panel panel-primary" >
         <div class="panel-heading">
            <h3 class="panel-title"> elenco
               <span class = "badge pull-right"> <?php echo "q.tà " . $result->num_rows; ?> </span>
            </h3>
         </div>
         <div class="panel-body">
         <form action = "<?PHP echo htmlspecialchars($_SERVER['PHP_SELF']); ?>" method="post" class="form-signin">
         <?php
            if($result->num_rows === 0){
               echo "non ci sono dati: cliccare su nuovo </br></br>";
            }else{
               $riga = mysqli_num_rows($result);
               $xHead = array('Id', 'Nome', 'Tipo');
               echo $db->xQueryToTableRD($result, $xHead, 'xRadioR');
            }
         ?>
      <?php if($result->num_rows > 0){ ?>
         <button type ="submit" name ="call_Mod_Regist" class = "pull-right btn btn-info">
            <span class = "glyphicon glyphicon-user"> Modifica </span>
         </button>
      <?php }?>
         <button type ="submit" name ="call_New_Regist" class = "pull-right btn btn-info">
            <span class = "glyphicon glyphicon-user"> Nuovo </span>
         </button>
         </form>
         </div>
      </div> </div>
      </body>
      </html>
    

0 个答案:

没有答案