PDA

View Full Version : AJAX refresh database page


m002.p
04-14-2010, 04:11 PM
Hello everyone,

I know little about AJAX, just how it works with JS. I have searched google before posting here and found little information to help me with my objective.

Can anyone explain and provide me with a coding example of how to refresh a database using AJAX on a php page.

To be clearer, I have a php page which displays a MYSQL database table Using the following code:

<?php

while ($row= mysql_fetch_array($result))
{

// Display rows & data of MYSQL table eg. $row['id'];
echo "<table><tr><td>{$row['id']}</td></tr></table>";

}
?>

When a new entry is inserted or removed, I would like AJAX to be able to update the page without the need for refresh.

I know it is possible, just an example of how to do it would be great!

Thanks

Matt