Skip to main content
Known Participant
July 3, 2006
Question

Displaying Search Results selectively

  • July 3, 2006
  • 7 replies
  • 541 views
Okay, I am passing the variable 'SearchString' to a search.php page. The search page has a recordset like this :

SELECT title, author, version
FROM books
WHERE title LIKE '%".$_GET["SearchString"]."%'
OR author LIKE '%".$_GET["SearchString"]."%'
OR date LIKE '%".$_GET["SearchString"]."%'
OR publisher LIKE '%".$_GET["SearchString"]."%'
ORDER BY title

So the recordset is displaying three fields (title, author, version). How do I get the search page to display only those sections of the table which contain the result?

Help appreciated!
This topic has been closed for replies.

7 replies

Participating Frequently
July 3, 2006
I am not visualizing the issue, So you are saying that you have recordset X that is asking for three fields from a DB. The recordset list in the Bindings gives you all the fields from the DB. I would recommend that you recheck your recordset. Can your post your entire query string?
Participating Frequently
July 3, 2006
In your bindings panel you should only see fields and not rows. These are two different things, Fields != Rows
hermeneutAuthor
Known Participant
July 3, 2006
Apologies - yes, I copy fields from my bindings panel into the search.php page, but rather than returning only those fields which contain a given query, the page returns them all.
Participating Frequently
July 3, 2006
It will only display what is in the query. If you are displaying more than you want, then it is likely a problem with your form for the query.

What is it displaying that you do not want it to?
hermeneutAuthor
Known Participant
July 3, 2006
My query looks exactly like the example one I added in my first post, except that it has about a dozen OR categories (as opposed to the three I include in my example). I've selected all these links from my Bindings panel and place them in my text. I now do a search, say, for "Cambridge"; only records which contain Cambridge are returned, but ALL the fields from my bindings panel are displayed rather than just those rows which contain "Cambridge."

As you say, it's probably something in my query. Any further ideas?
hermeneutAuthor
Known Participant
July 3, 2006
Yes, and all contents of these fields are returned. Any suggestions?
Inspiring
July 3, 2006
hermeneut wrote:
> But won't this display all items, rather than just the ones which contain the term used in the query?

Have you actually tried it?

--
David Powers
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
Author, "Foundation PHP 5 for Flash" (friends of ED)
http://foundationphp.com/
hermeneutAuthor
Known Participant
July 3, 2006
But won't this display all items, rather than just the ones which contain the term used in the query?
Inspiring
July 3, 2006
hermeneut wrote:
> So the recordset is displaying three fields (title, author, version). How do
> I get the search page to display only those sections of the table which contain
> the result?

Your recordset has already made the selection. Just drag the items you
want to display from the Bindings panel, and put them in a repeat region.

--
David Powers
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
Author, "Foundation PHP 5 for Flash" (friends of ED)
http://foundationphp.com/