嗨,当用户从用户级别更新某些内容时,我需要使用while循环来循环

时间:2016-07-14 11:45:23

标签: php mysql sql-server

<?php
include 'core/init.php';
include 'includes/overall/header.php';  

if(isset($_POST['btn_submit'])){

 $sqlQuery = mysql_query("UPDATE `table1` SET   `ATR`='".mysql_real_escape_string($_POST['ATR'])."' ");
$result = "SELECT  * FROM position";
$finalResult = mysql_query($result) or die(mysql_error());

}
?>

<h2><font color="blue">Table that shows edit history:</h2>
<table border="1" cellpadding="5px" cellspacing="0" width="60%">
     <tr>
     <th><strong>row1</strong></th>
     <th><strong>row2</strong></th>
     <th><strong>row3</strong></th>
     <th><strong>row4</strong></th>
     <th><strong>row5</strong></th>
     </tr>

     <?php 

   while($row5 = mysql_fetch_assoc($finalResult)) { 
         echo "<td>".$row5['row1']."</td>";
         echo "<td>".$row5['row2']."</td>";
         echo "<td>".$row5['row3']."</td>";
         echo "<td>".$row5['row4']."</td>";
         echo "<td>".$row5['row5']."</td>";
         continue;

     ?>



<?php


    mysql_close();


    }

    mysql_free_result($sqlQuery);





?>

您正在尝试做的是用户能够更新,然后选择所有更新并循环并显示所有更新。但是,它只显示表格中的一个更新,我需要所有行,然后消失。

0 个答案:

没有答案