Welcome to dbForumz.com!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Search page result links

 
   Database Forums (Home) -> PHP RSS
Next:  UTF-8 file reading and writing for PHP  
Author Message
Chris

External


Since: May 15, 2006
Posts: 1



(Msg. 1) Posted: Thu Jul 06, 2006 11:45 am
Post subject: Search page result links
Archived from groups: comp>lang>php (more info?)

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_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
'%$keyword%'";
$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>
</tr>
<tr>
<td><strong> Link </strong></td>
<td> <strong>Description</strong></td>
<td> <strong>Project </strong></td>
</tr>
<?php
do { ?>
<tr>
<td>
<a href="<?php if ($row_search['docs.projID'] == 1) {
echo $row_search['catName']."/".$row_search['docURL'];
}
else {
echo
$row_search['groupCode']."/".$row_search['projCode']."/".$row_search['catName']."/".$row_search['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_assoc($search)); ?>

</table>

---snip---

Thanks,
Chris

 >> Stay informed about: Search page result links 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Popups from links - Heya all I have a script that allows my website to display the contents of a folder as links. I want those links to open as their MIME type (MP3 files) in a small window, displaying that file's name as an H2 tag. Can someone help me out? Here's the..

Parsing content for links - I have a content management system that has links within the content field in the database and I need to verify if those links are correct. What I need to have happen is have a php script query the database and then parse through the content field to fin...

Problem with links with form data - Less than 1% of my users say they can not open links like this: index.php?variable=value&variable2=value2 Is anyone aware of some firewall/security setting that would prevent people from clicking on such types of links?

Total result php mysql - PHP Mysql limit the result to 5 I can display the 5 results using a do & while which it ok. I want to list the total or all the results without using a do or while this is so I can combine the results and remove duplicate words from the total resul...

CURL: Result on console and in PHP are different - I have some problems with the curl. On the console I get the right response message but in PHP I see no difference between a valid and an invalid SSL Certificate. Curl command in PHP: $url = ' https://verisign.com'; $ch = curl_init();..
   Database Forums (Home) -> PHP All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]