Sayfayı yeniden yükler php script

1 Cevap php

I'm having difficulty with pages that does not show the updated data immediately Here's my current one:

<?php
$con = mysql_connect("localhost","root","");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("hospital", $con);

$result = mysql_query("SELECT * FROM t2");

 echo"<br>";
 echo"<big>All In Patients</big>";
echo "<table border='1'>
<tr>
<th>Pnum</th>
<th>HospNum</th>
<th>RoomNum</th>
<th>LastName</th>
<th>FirstName</th>
<th>MidName</th>
<th>Address</th>
<th>TelNum</th>
<th>Stat</th>
<th>Nurse</th>
</tr>";

while($row = mysql_fetch_array($result))
  {
   echo "<tr>";
   echo "<td>" . $row['PNUM'] . "</td>";
  echo "<td>" . $row['HOSPNUM'] . "</td>";
  echo "<td>" . $row['ROOMNUM'] . "</td>";
    echo "<td>" . $row['LASTNAME'] . "</td>";
      echo "<td>" . $row['FIRSTNAME'] . "</td>";
        echo "<td>" . $row['MIDNAME'] . "</td>";
          echo "<td>" . $row['ADDRESS'] . "</td>";
           echo "<td>" . $row['TELNUM'] . "</td>";
            echo "<td>" . $row['STAT'] . "</td>";
            echo "<td>" . $row['NURSE'] . "</td>";

  echo "</tr>";
  }
echo "</table>";

mysql_close($con);
?>

<form>
<input type="button"  class='type_button'  value="Print" onClick="window.print();" /> 
</form>
</body>
</html>

Eğer güncellenmiş Yukarıdaki kod yapabilir herhangi bir geçici çözüm biliyor musunuz? Ben veri güncelleme ve sonra yukarıdaki kodunu yüklediğinizde Çünkü. Sadece henüz güncellenmemiş olan önceki verileri gösterir. Sen etkilerini görmek için tıklayın ve sayfayı yenileyin sağa olacak.

1 Cevap

Sen önbellek başlıklarını ayarlamak için deneyebilirsiniz.

<?php
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
?>

Ya da belki MySQL önbelleğe veri getiriliyor edilir?

SELECT SQL_NO_CACHE * FROM t2