I am trying to get the difference in seconds between the date/time in the column 'last_visited' in my table 'users' and the current date/time for a particular user. I think the following query should do it:
$query ="SELECT unix_timestamp(NOW()) - unix_timestamp(last_visit) from users WHERE username='$user'";
$result=mysql_query($query) or die(mysql_error());
However, I am not sure how to get the result from this as a variable so that I can pass it to a PHP function. Could someone help with this?