I have this script that pulls post data from a database and displays it on my site. I need this to update in real time with Ajax whenever the topics table updates. I know literally nothing about Ajax. Can someone assist with this please?
<?php
//connect to the server
$connect = mysql_connect("localhost","","");
//connect to the database
mysql_select_db("");
//query the database
$query = mysql_query("SELECT * FROM topics ORDER BY last_post");
//fetch the results / convert results into an array
WHILE($rows = mysql_fetch_array($query)):
$topic_id = $rows['last_post'];
$topic_title = $rows['title'];
$reply_author = $rows['last_poster_name'];
$reply_time = date('h:i A', $rows['last_post']);
$reply_date = date('l, F d, Y', $rows['last_post']);
endwhile;
echo "The last post was made in <font color='blue'>$topic_title</font> by <font color='red'>$reply_author</font> at <font color='green'>$reply_time</font> on <font color='brown'>$reply_date</font>.";
?>