I'm building an app with JQuery Mobile. I have a page called list.php which gets data from server with PHP. I need the script to run every 15 seconds and notify user if there are changes in database. I am beginner with PHP and Javascript so I have no idea how to do this or if it is even possible.
This is the code I'm currently using.
<?php
$number = $_GET['number'] ;
mysql_connect('localhost','username','password');
$link = mysql_connect('localhost', 'username', 'password');
if (!$link) {
    die('Could not connect: ' . mysql_error());
}
//specify database 
mysql_select_db("database") or die("Unable to select database"); 
// Build SQL Query 
$query = "select * from table where tablenumber = \"$number\" and state = 0  
  order by time";
 $result = mysql_query($query) or die("Couldn't execute query");
?>
<!DOCTYPE html> 
<html> 
    <head> 
    <title>title</title> 
    <meta name="viewport" content="width=device-width, initial-scale=1"> 
    <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.css" />
    <script src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
    <script src="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.js"></script>
</head> 
<body> 
<div data-role="page">
    <div data-role="header" > 
    <h1>Transpanel</h1>
</div>
    <div data-role="content">   
        <div data-role="collapsible-set">
    <?php 
// display the results returned
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
?>
<div data-role="collapsible" data-theme="b" data-content-theme="d">
   <h3><?= $row["OSO"] ?></h3>
   <p><?=$row["AIKA"]?><p>
</div>
<?php } ?>
</div>
    </div><!-- /content -->
</body>
</html>
 
     
     
     
     
     
    
= $row["OSO"] ?>
=$row["AIKA"]?>