Re: Search MySQL db with PHP
- From: "Chris" <designerNOSPAM@xxxxxxxxxxxxxx>
- Date: Wed, 28 Jun 2006 10:23:36 -0700
I now have it showing in the content section of the current page, however I
still don't have it set up to display more than 1 page. I am working on
that....but I have discovered that my query isn't working well in the PHP
display, but it works just fine in my SQLyog query analyzer. I am querying
2 tables - one with the actual links which has a foriegn key to a table that
lists the project that the page is related to. I have tried several joins -
using a RIGHT or INNER JOIN I get the proper result in the query analyzer of
only 2 links which both relate to only 1 project. However, when I run this
same query in PHP it gives me the same set of links to every project
(cartesian product). Is this a PHP issue, and if so, how do I handle it?
Thanks,
Chris
Here is the current query & search page which is fine in the query analyzer
but not on the page:
<?php include('Connections/website.php'); ?>
<?php
$currentPage = $_SERVER['PHP_SELF'];
$keyword = $_POST['keyword'];
mysql_select_db($database_website, $website);
$query_search = "SELECT Distinct docURL, docTitle, docDesc, docs.projID,
projCode FROM docs INNER JOIN proj on docs.projID=proj.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);
?>
<p>
<?php do { ?>
<a href="<?php echo $row_search['PHP_Practice/docURL']; ?>"><?php echo
$row_search['docTitle']; ?></a> :<br />
<strong>Description:</strong> <?php echo $row_search['docDesc']; ?>,
<strong>Project:</strong> <?php echo $row_search['projCode']; ?><br /><br />
<?php } while ($row_search = mysql_fetch_assoc($search)); ?>
</p>
<?php
mysql_free_result($search);
?>
"Chris" <designerNOSPAM@xxxxxxxxxxxxxx> wrote in message
news:e7s19f$3ao$1@xxxxxxxxxxxxxxxxxxx
Hi again,
Sorry Lorento - my brain typed Lorenzo :)
I got the search to work finally, however, I am having issues with getting
it to limit to a certain number of results per page. Then, of course,
there's getting the results to show in the content section of each page
since all pages have includes for the header, navigation, and footer
sections. Any guidelines on this would be appreciated.
Thanks,
Chris
.
- Follow-Ups:
- Re: Search MySQL db with PHP
- From: Chris
- Re: Search MySQL db with PHP
- References:
- Search MySQL db with PHP
- From: Chris
- Re: Search MySQL db with PHP
- From: lorento
- Re: Search MySQL db with PHP
- From: Chris
- Re: Search MySQL db with PHP
- From: Chris
- Search MySQL db with PHP
- Prev by Date: Re: Why php ?
- Next by Date: Re: Search MySQL db with PHP
- Previous by thread: Re: Search MySQL db with PHP
- Next by thread: Re: Search MySQL db with PHP
- Index(es):
Relevant Pages
|