<?php
Class BreadCrumbs {
public static function getCatLinkFromPosting($postID) {
$getCatIDRes = mysql_query("SELECT Categories.name, Categories.id, Postings.cityID FROM Postings, Categories WHERE Postings.id='$postID' AND Categories.id = Postings.category");
$getCatIDObj = mysql_fetch_object($getCatIDRes);
$name = $getCatIDObj->name;
$id = $getCatIDObj->id;
$cityID = $getCatIDObj->cityID;
$link = "<a href='location.php?locationType=City&id=$cityID&catID=$id' title='$name'>$name</a>";
return $link;
}
public static function getCityLinkFromPosting($postID) {
$getCityIDRes = mysql_query("SELECT Cities.name, Cities.id FROM Postings, Cities WHERE Postings.id='$postID' AND Cities.id = Postings.cityID");
$getCityIDObj = mysql_fetch_object($getCityIDRes);
$name = $getCityIDObj->name;
$id = $getCityIDObj->id;
$link = "<a href='location.php?locationType=Category&id=$id' title='$name'>$name</a>";
return $link;
}
public static function makePostFromPosting($postID) {
$getCityIDRes = mysql_query("SELECT Cities.name, Cities.id, Postings.category FROM Postings, Cities WHERE Postings.id='$postID' AND Cities.id = Postings.cityID");
$getCityIDObj = mysql_fetch_object($getCityIDRes);
$cityName = $getCityIDObj->name;
$cityID = $getCityIDObj->id;
$catID = $getCityIDObj->category;
$link = "<a href='addPosting.php?cityID=$cityID&catID=$catID' title='Make A Posting'>Make A posting in this category.</a>";
return $link;
}
public static function getCityNameFromCityID($cityID) {
$getCityNameRes = mysql_query("SELECT name FROM Cities WHERE id='$cityID'");
$getCityNameObj = mysql_fetch_object($getCityNameRes);
$name = $getCityNameObj->name;
$link = "<a href='location.php?locationType=Category&id=$cityID' title='$name'>$name</a>";
return $link;
}
}
?>