Help with search script

Discussion in 'PHP' started by hmilesjr, Nov 22, 2006.

  1. #1
    I am having a problem with the search function on my site financenewstoday.com. When you search for a keyword, it is returning the results without the appropriate assigned folders. For example: http://www.financenewstoday.com/realestate/mortgage/article_index.php?pg=ShowArticle&aID=245 (Correct) is showing as http://www.financenewstoday.com/article_index.php?pg=ShowArticle&aID=245 (Incorrect).

    Can anyone point me in the right direction to fix this? This is the code on the search page:

    <?



    if(isset($pg))
    {
    switch($pg)
    {
    case 'ShowSearchResults':

    if(isset($_REQUEST['keyword']))
    {
    if(@mysql_num_rows($q=mysql_query("SELECT * FROM articles WHERE (headline LIKE '%".$_REQUEST['keyword']."%' or article like '%".$_REQUEST['keyword']."%' or keywords like '%".$_REQUEST['keyword']."%' ) and status='Publish' ORDER BY headline_date DESC, id DESC")))
    {
    //print "<div class=general_txt>";
    while($fq=mysql_fetch_object($q))
    {

    print "<strong><a href='".$art_reader."?pg=ShowArticle&aID=".$fq->id."'>".$fq->headline."</a></strong><br>".$fq->summary."<p>";

    }
    //print "</div>";
    }
    else
    {
    print "No articles found using: ". $_REQUEST['keyword'] . "!";
    }
    } else {
    print "No articles found using: ". $_REQUEST['keyword'] . "!";
    }
    break;



    case 'ShowSectionContent':
    if(isset($_REQUEST['sID']))
    {
    if(@mysql_num_rows($q=mysql_query("SELECT * FROM articles WHERE zones LIKE '%[".$_REQUEST['sID']."]%' AND status='Publish' ORDER BY featured DESC, id DESC")))
    {
    //print "<div class=general_txt>";
    while($fq=mysql_fetch_object($q))
    {
    if($fq->featured)
    {
    print "<span class='headline'><a href=".$art_reader."'?pg=ShowArticle&aID=".$fq->id."'>".$fq->headline."</a></span><p>".$fq->summary."<p>";
    }
    else { print "<br><strong>&raquo;</strong> <a href='?pg=ShowArticle&aID=".$fq->id."'>".$fq->headline."</a>"; }
    }
    //print "</div>";
    }
    else
    {
    print "No articles found under this category!";
    }
    }
    break;
    case 'ShowArticle':
    require("inc/functions.inc.php");
    if(isset($_REQUEST['aID']))
    {
    $q=mysql_query("SELECT zones FROM articles WHERE id='".$_REQUEST['aID']."'");
    $fq=mysql_fetch_object($q);
    $mainz = explode("]",$fq->zones);
    $mainz = $mainz[0];
    $mainz = str_replace("[","",$mainz);
    print ApplyTemplate($_REQUEST['aID'],$mainz);
    }
    break;
    }
    }
    else { print "&nbsp;";}
    ?>
     
    hmilesjr, Nov 22, 2006 IP
  2. lbalance

    lbalance Peon

    Messages:
    381
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    0
    #2
    looks like your $art_reader variable is not being assigned as the full path
     
    lbalance, Nov 22, 2006 IP