Search and display article
Posted: Fri Aug 31, 2007 1:21 am
Code: Select all
$pieces = explode(",", $row['tags']);
for($i = 0; $i<sizeof($pieces); $i++)
{
$tags = mysql_fetch_assoc(mysql_query("SELECT DISTINCT id FROM wow WHERE 0 OR CONCAT(title,content,'') LIKE '%".$pieces[$i]."%' AND id!=$page ORDER BY id DESC"));
echo $pieces[$i];
echo " ";
}
-----part 2-----
for($i = 0; $i<sizeof($pieces); $i++)
{
echo "<br />";
$related = mysql_fetch_assoc(mysql_query("SELECT DISTINCT id,title FROM wow WHERE 0 OR CONCAT(title,content,'') LIKE '%".$pieces[$i]."%' AND id!=$page ORDER BY id DESC"));
if(isset($related)){
echo '<a href="pages.php?catid='.$row['catid'].'&page='.$related['id'].'"><strong>' .$related['title'].'</strong></a>';
}}