I have an employees table here to see whether they are in the office or out. I have a php file to select the status from the database. I tried changing the status from out to in and in to out in the database but I cannot see any changes in my php page until I reload it. How can I get my php page change automatically when there is a change in the database?? I m a newbie so please help out... Thanks in advance. I have the php file here:
<?php
$dbhost = 'localhost';
$dbuser = 'root';
$dbpass = 'pass';
$conn = mysql_connect($dbhost, $dbuser, $dbpass);
if(! $conn )
{
die('Could not connect: ' . mysql_error());
}
$sql = 'SELECT Name,Status FROM Employees';
mysql_select_db('new');
$retval = mysql_query( $sql, $conn );
if(! $retval )
{
die('Could not get data: ' . mysql_error());
}
while($row = mysql_fetch_array($retval, MYSQL_ASSOC))
{
echo "Name :{$row['Name']} <br> ".
"Status: {$row['Status']} <br> ".
"--------------------------------<br>";
}
echo "Fetched data successfully\n";
mysql_close($conn);
?>