rendered paste body <?php
$con = mysql_connect("localhost","ypeceb2m_files","files");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("ypeceb2m_files", $con);
$text = $_GET['tag'];
for ($i=0; $i<count($text); $i++) {
$result = mysql_query("SELECT * FROM files WHERE tags LIKE '%".$text[$i]."%'") or die(mysql_error());
$shown = array();
while ($row = mysql_fetch_array($result)) {
if (!array_search($row['name'], $shown))
{
$shown[] = $row['name'];
echo "Name: {$row['name']} <br>";
echo "Description: {$row['description']} <br>";
echo "Location: <a href='{$row['location']}'>{$row['location']}</a> <br> ";
echo "Tags: ";
$tags = explode(', ', $row['tags']);
foreach($tags as $a=>$b)
{
echo "<a href = 'tag.php?tag=$b'>$b</a> ";
}
echo "<br /> <br />";
}
}
}
?>