Replace:
$query = "SELECT *, DATE_FORMAT(`datecreated`, '%M %e, %Y') as datecreated FROM titlehistory";
if ($r = mysql_query ($query)){ // Run the query.
while ($row = mysql_fetch_array ($r)){
}
With:
$query = "SELECT *, DATE_FORMAT(`datecreated`, '%M %e, %Y') as datecreated FROM titlehistory";
$result = mysql_query($query) or die ("Error in query: $query. ".mysql_error());
$row = mysql_fetch_assoc($result);
If that doesn't work you need to start debugging...
Use neil.johnson's suggestion. Put the query into PhpMyAdmin, or whatever web app you use, and see if the correct results return. If they don't there's something wrong with your sql statement (wrong table name, field name etc...). If you get the correct results then go back and try and just