Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Displaying Search Results selectively

New Here ,
Jul 03, 2006 Jul 03, 2006
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!
TOPICS
Server side applications
547
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 03, 2006 Jul 03, 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/
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 03, 2006 Jul 03, 2006
But won't this display all items, rather than just the ones which contain the term used in the query?
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 03, 2006 Jul 03, 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/
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 03, 2006 Jul 03, 2006
Yes, and all contents of these fields are returned. Any suggestions?
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jul 03, 2006 Jul 03, 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?
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 03, 2006 Jul 03, 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?
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 03, 2006 Jul 03, 2006
LATEST
hermeneut wrote:
> 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."

When you do a search for "Cambridge", how are you verifying that only
records containing "Cambridge" are returned? If the query works
correctly when you test it in the Recordset dialog box, then the results
should contain only those records that you want.

Are you selecting the correct recordset in the Bindings panel? Or is
your query producing the wrong results in the first place?

--
David Powers
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
Author, "Foundation PHP 5 for Flash" (friends of ED)
http://foundationphp.com/
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jul 03, 2006 Jul 03, 2006
In your bindings panel you should only see fields and not rows. These are two different things, Fields != Rows
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 03, 2006 Jul 03, 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.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jul 03, 2006 Jul 03, 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?
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines