Search page result links

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Chris

    Search page result links

    Hi,

    I have a search function pulling data from a MySQL db which works nicely -
    other than the fact that I can't get the URL to link correctly when the
    linked document is located in the home directory. All other docs are
    located below the home directory by group/project/category. When I try to
    use an 'if' statement for one of the query parameters, I either lose the
    link, get a link that has the doc that is in the home directory with the
    full path (that doesn't really exist as folders), or get an undefined index
    error. Here is my current code - I have edited it several times over that
    past couple of hours, so I have reached the point of not being able to tell
    what is correct, and what isn't. I have used projCode, groupCode, projID,
    groupID parameters and still can't find the magic solution. I would really
    appreciate another set of eyes.

    ---snip---

    mysql_select_db ($database_webs ite, $website);
    $query_search = "SELECT Distinct docURL, docTitle, docDesc, docs.projID,
    groupCode, projCode, catName FROM docs
    JOIN subcat on subcat.subcatID =docs.subcatID
    JOIN cat on cat.catID = subcat.catID
    JOIN groups on groups.groupID= proj.groupID
    JOIN proj on proj.projID=doc s.projID WHERE proj.projID=doc s.projID AND
    docURL LIKE '%$keyword%' OR docTitle LIKE '%$keyword%' OR docDesc LIKE
    '%$keyword%'";
    $search = mysql_query($qu ery_search, $website) or die(mysql_error ());
    $row_search = mysql_fetch_ass oc($search);
    $totalRows_sear ch = mysql_num_rows( $search);
    $proj = $row_search['projCode'];
    ?>
    <?php if ($totalRows_sea rch < 1)
    {
    echo "No internal documents matched your request.";
    }

    else {?>

    <p><table width=95%>
    <tr><td colspan="3"><fo nt size="+1">Inter nal Documents:</font></td>
    </tr>
    <tr>
    <td><strongLi nk </strong></td>
    <td<strong>Desc ription</strong></td>
    <td<strong>Proj ect </strong></td>
    </tr>
    <?php
    do { ?>
    <tr>
    <td>
    <a href="<?php if ($row_search['docs.projID'] == 1) {
    echo $row_search['catName']."/".$row_sear ch['docURL'];
    }
    else {
    echo
    $row_search['groupCode']."/".$row_sear ch['projCode']."/".$row_sear ch['catName']."/".$row_sear ch['docURL'];
    ?>"><?php echo $row_search['docTitle'];
    } ?></a></td>
    <td><?php echo $row_search['docDesc']; ?></td><td><?php echo
    $row_search['projCode']; ?></td>
    </tr>
    <?php } while ($row_search = mysql_fetch_ass oc($search)); ?>

    </table>

    ---snip---

    Thanks,
    Chris


Working...