You are here: Re: Search MySQL db with PHP « All PHP « IT news, forums, messages
Re: Search MySQL db with PHP

Posted by Chris on 10/10/16 11:51

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@centurytel.net> wrote in message
news:e7s19f$3ao$1@news01.intel.com...
> 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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация