Search page result links

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!


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.


mysql_select_db($database_website, $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=docs.projID WHERE proj.projID=docs.projID AND  
docURL LIKE '%$keyword%' OR docTitle  LIKE '%$keyword%' OR docDesc LIKE  
$search = mysql_query($query_search, $website) or die(mysql_error());
$row_search = mysql_fetch_assoc($search);
$totalRows_search = mysql_num_rows($search);
$proj = $row_search['projCode'];
<?php if ($totalRows_search < 1)
 echo "No internal documents matched your request.";

 else {?>

<p><table width=95%>
<tr><td colspan="3"><font size="+1">Internal Documents:</font></td>
 <td><strong> Link </strong></td>
 <td> <strong>Description</strong></td>
 <td> <strong>Project </strong></td>
  do { ?>
    <a href="<?php if ($row_search['docs.projID'] == 1) {
 echo $row_search['catName']."/".$row_search['docURL'];
 else {
?>"><?php echo $row_search['docTitle'];
 } ?></a></td>
 <td><?php echo $row_search['docDesc']; ?></td><td><?php echo  
$row_search['projCode']; ?></td>
    <?php } while ($row_search = mysql_fetch_assoc($search)); ?>




Site Timeline