Skip to main content
Known Participant
November 7, 2006
Question

Execute a query with a link

  • November 7, 2006
  • 13 replies
  • 1064 views
I need to execute a query with a link. For example, I am working on my picture gallery at www.truckerstoystore.net/gallery.cfm and would like to add a Popular Searches section where the user can click a link such as "Chevy" and a query called Chevy that outputs all pictures in the given table containing Chevy in any of the fields would display the pictures where the pictures display when you search. Can anyone help me?

My other idea was to try to figure out how to make a link that would specify search keywords to the existing PicSearch query.

If anyone would be so kind as to help me out, that would be awesome...I'm stumped! Here is the file I'm working on: gallery.zip
    This topic has been closed for replies.

    13 replies

    November 8, 2006
    as long as the query uses the "keywords" in where statement...

    SELECT cars
    FROM cartable
    WHERE cartype = '#keywords#' ;

    i would use someting other that keywords though such as "cartype"...? or some other abstract
    Inspiring
    November 8, 2006
    To expand on dempster's answer, if you are passing text (as opposed to numbers) use the urlencodedformat function to pass your variables. Otherwise you might not get the results you were hoping for.

    Not that it's ever happened to me, but I think I read about it somewhere.
    Inspiring
    November 8, 2006
    In your current site, the user enters a search term, you submit the form and then display the results. You can pass a predefined query parameter in a similar fashion, with a link such as gallery.cfm?keywords=Chevy . Your page can get this with the URL parameter URL.keyword and search on that value.
    Known Participant
    November 8, 2006
    So all I have to do is insert a regular link like the code below, or do I have to "pre-define" it elsewhere. I guess what I'm asking is: Does that link cause my search query to search for "chevy" just as if the user typed "chevy"?