Well according to the mySQL documentation:
NOW():
Returns the current date and time as a value in 'YYYY-MM-DD HH:MM:SS' or YYYYMMDDHHMMSS format, depending on whether the function is used in a string or numeric context.
So, is it a string or number? Most likely string. Okay, so we've got when it was inserted. How about now? Well that's easy:
date('U');
// OR
time();
Now, date('U') would be safer as it rely's upon the server time, and so does the mySQL clock.
So we've got the current time in a UNIX timestamp, and the mySQL string. To get the string to a timestamp, we use [man]strtotime/man. So just quickly say strtotime($mysql_stamp)...
Now, it's just a matter of seeing how many hours ago the mySQL timestamp was....
<?php
$query = "SELECT PostedOn FROM table ORDER BY PosteOn DESC LIMIT 1";
$result = mysql_query($query);
while($row = mysql_fetch_array($result))
{
$now = date('U');
$posted = strtotime($row['PostedOn']);
$diff = $now-$posted;
$hour = 60 * 60; // 60 seconds * 60 minutes = 3600 seconds
echo 'It has been '.(round($diff/$hour)).' hours since the last posting';
}
?>
Now, an alternative is to allow mySQL to create the Unix Timestamp for you:
<?php
$query = "SELECT UNIX_TIMESTAMP(PostedOn) as tS
FROM table
ORDER BY PostedOn DESC
LIMIT 1";
$result = msyql_query($result);
$posted = mysql_fetch_result($result, 0, 'tS'); // get the one result we need ;)
$now = date('U');
$diff = $now-$posted;
$hour = 60 * 60;
$hours = round($diff/$hour);
echo 'It has been '.$hours.' hours since the last posting.';
?>
Hope that helps you.