";
// Tags have whitespace attached
$resource_id = $row["id"];
// Query tags for display
$res_info_query = " SELECT DISTINCT
Tags.tag_name,
categories.name
FROM Tags
JOIN Resource_tags on Resource_tags.tag_id = Tags.tag_id
JOIN Resources on Resources.id = Resource_tags.resource_id
JOIN service_category_tag on service_category_tag.tag_id = Tags.tag_id
JOIN service_types on service_category_tag.service_type_id = service_types.id
JOIN categories on categories.id = service_category_tag.category_id
WHERE Resources.id = " . $mysqli->real_escape_string($resource_id) . " AND service_types.name = '" . $service_type . "'";
// Output results of query depending on type of page to view
if ($res_info_result = $mysqli->query($res_info_query)) {
switch ($service_type) {
case 'Shelter':
$stipulations = "";
$accessibility = "";
$access = "";
while ($res_info_row = $res_info_result->fetch_assoc()) {
if ($res_info_row['name'] == "Stipulations") {
$stipulations .= $res_info_row['tag_name'] . ", ";
} else if ($res_info_row['name'] == "Best Way to Access Services") {
if ($res_info_row['tag_name'] == "Website") {
$access .= "
";
$access .= $res_info_row['tag_name'] . ", ";
} else {
$access .= $res_info_row['tag_name'] . ", ";
}
} else {
$accessibility .= $res_info_row['tag_name'] . ", ";
}
}
$accessibility = rtrim($accessibility, ", ");
$stipulations = rtrim($stipulations, ", ");
$access = rtrim($access, ", ");
echo "
Additional Services and Accessibility
" . $accessibility . "
";
if ($stipulations == "") {
echo "
No Stipulations
";
} else {
echo "
Stipulations
". $stipulations . "
";
}
if ($access) {
echo "
Best Way to Access Services
";
echo "
". $access . "
";
}
break;
default:
$prev_cat = "";
$tag_string = "";
while ($res_info_row = $res_info_result->fetch_assoc()) {
if ($prev_cat == "") {
echo "
".$res_info_row['name']."
";
} else if ($prev_cat != $res_info_row['name']) {
$tag_string = rtrim($tag_string, ", ");
echo ($tag_string) ? $tag_string : "
No details specified.
";
echo "
".$res_info_row['name']."
";
$tag_string = "";
}
$tag_string .= $res_info_row['tag_name'] . ", ";
$prev_cat = $res_info_row['name'];
}
$tag_string = rtrim($tag_string, ", ");
echo ($tag_string) ? $tag_string : "
No details specified.
";
break;
}
}
if ($url) {
echo "
Website
";
echo "
";
}
if ($comments) {
echo "
Comments
";
echo "
".$comments."
";
}
echo "