rendered paste body mysql_select_db("ypeceb2m_files", $con);
$searchtext = $_POST['search'];
$temp = explode(", ", $searchtext);
for ($i=0; $i<count($temp); $i++)
{
$result = mysql_query("select * from files,tags where tags.id = files.id and tags.tag LIKE '%".$temp[$i]."%'") or die(mysql_error());;
$lastid = -1;
while ($row = mysql_fetch_array($result))
{
if ($row['id'] != $lastid)
{
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['tag']);
foreach($tags as $a=>$b)
echo "<a href = 'tag.php?tag=$b'>$b</a> ";
// no idea >> $lastid = $row['id'];
echo "<br />";
echo "Uploaded by: {$row['author']}";
echo "<br /> <br />";
}
else
{
//if (mysql_num_rows($result) > 0)
//{
while ($row = mysql_fetch_array($result))
//{
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['tag']);
foreach($tags as $a=>$b)
{
echo "<a href = 'tag.php?tag=$b'>$b</a> ";
}
echo "<br />";
echo "Uploaded by: {$row['author']}";
echo "<br /> <br />";
//}
//}
//else
//{
echo "Nothing found! Please refine your search.";
}
}
}
?>