PHP脚本重新加载

I have a file which is of php type. And I have a combination of HTML elements, javascript functions and some PHP scripts as well. I want to rerun the php script say some part of the script again and again. lets take this example:

<html>
    <?php
        $connection = mysql_connect('localhost','root','root');
        $db = mysql_select_db('messenger');
        if ($db == null)
        {
            echo "hello";
        }

        $messagecheck = "select * from Messages where destination = '$user' && status = 'ACTIVE'";
        $result = mysql_query($messagecheck);
        $no_rows = mysql_num_rows($result);
        ............
    ?>
    <body>
        ........
        <form>
            <input type="submit">
            .......
        </form>
    </body>
</html>

I want to run the above php script continuously for every 1 min from the same file. When I make use of location.reload() I find that complete document gets reloaded. I just want the affect the part of the page which php script accesses and not the whole doc.

How can I do that? Please help.

You can't do that out of the box, since php is called when the page is loaded.

You should take a look at Ajax or frameworks like JQuery, that embed Ajax.

As previously said by blue112 you need to use Ajax in order to get what you want.

If I did understand well what you need, a simple solution is using an iframe where you point to a file with only the php code you want to execute, and reload it every time you want.

I hope this helps