By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,591 Members | 629 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,591 IT Pros & Developers. It's quick & easy.

Search page result links

P: n/a

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><strongLink </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)); ?>



Jul 6 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.