Q:

auto reload: how it works?

i need to  change something in my site, if some fields changed in database, but without reloading the page! but i have no idea how i can do it. 
could you give me an idea? thanks
example:
for example, i have a forum, and i need to show a image, if new comment resieved! i can write all functions, but i don't understand when i must call the function?
maybe window.onload?

A:

Then you need AJAX!
Explanation:
You need two pages, the main page which does not "reload". And a second one which returns two versions of the small image based on the database field.
Page one has this JavaScript in it:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script>
<script type="text/javascript">

/* normal ajax without periodical refresh
$.ajax({
  url: 'page2.php',
  success: function(data) {
    $('#database_status').html(data);
  }
});
*/

var refreshId = setInterval(function() {
     $('#database_status').load('/path/to/your.php');
}, 3000);
</script>

// Or you use the jQuery plugin Heartbeat: http://www.jasons-toolbox.com/JHeartbeat/ 

And a div <div id="database_status">empty</div>
The second page, returns a image tag based on the database setting for example in PHP:
<?php
// do db request 
if ($request) {
    echo '<img src="true.gif"> TRUE';
} else {
    echo '<img src="false.gif"> FALSE';
}

