Re: Search MySQL db with PHP



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


.



Relevant Pages

  • Re: Object Oriented Content System - the idea
    ... >I expected php to be smarter then that. ... >form like bytecode in memory for the next request. ... each action added some stuff to a "response" XML document. ... that map/object/data and formats it for HTML display using an includeed PHP ...
    (comp.lang.php)
  • Re: session trouble
    ... Note that you're building your display block AFTER your loop. ... <?php session_start; ... The problem here is going to be since you have multiple school clubs, it's going to be hard to relate a particular club to the entry in your database if it going to be changed. ... Another way is to add a suffix to each field, often times the primary key for the table. ...
    (comp.lang.php)
  • Re: Redirecting between PHP Pages
    ... but at the very least in a php script. ... > on the outcome of the validation, you want to do one of two things: ... with the various bits of HTML being ... Display login form ...
    (comp.lang.php)
  • Re: Open and process remote page
    ... William Hudson wrote: ... I have toyed with some of the php functions for opening URLs, ... > I need to fully emulate a browser, ... > display the remote page). ...
    (comp.lang.php)
  • Re: Redirecting between PHP Pages
    ... Display login form ... >>other php files, you should never need a redirect your page except to ... pass it on to smarty which then displays it as html for me. ...
    (comp.lang.php)