Jump to content

refine search method


turpentyne

Recommended Posts

I'm trying to figure out something that's quite a bit beyond my meager knowledge of PHP, and not sure exactly what's the best way. Kind of confused and lost in the woods without a map.

 

I have a paginated PHP results page that builds its query based on $_GET variables from a previous search page. Then I'm putting down one side of the page, a form full of options to refine the search results.

 

What I want to happen is, when somebody selects something on the "refine search" form, it autosubmits and adds that variable to the URL as "&variable="chosenItem" - but also to say in which table to search for that variable. Then I want the page to reload, change the PHP query to include the tables to join and search variables. Holy cow this is alot to figure out in my head!

 

I've gotten as far as turning most of the query into variables, but not sure if there's a more sensible way to do this or what. Something like this:

 

$select = 'Select Maintable.*, table2.*, table4.*'

//this would change based on which tables were in the url $_GET

$from = 'from Maintable.field1'

$on = 'on table1.id=table.2'

$where = 'WHERE x=x AND y=y AND z=z

//this also would change based on the url $_GET

//then

 

$query = ($SELECT $FROM $WHERE)

 

 

Beyond this, I have no idea how to get the variables into the url to begin with, nor if this will work. Maybe I'm trying too hard. Maybe there's some simple ways to do this that somebody can explain.

 

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.