Jump to content

Seeking tutorial on linked based queries w/ php and mysql


programguru

Recommended Posts

Hello,

 

I am having a very difficult time finding a decent tutorial that teaches a method of creating link based search queries.

 

I'm not doing anything that large, but I'm just trying to get the concept of how that is done properly, so I can apply it on any scale.

 

For example:

 

Select a Sport: (PAGE #1)

Tennis

Golf

Yoga

 

You selected Yoga . Please select a Style: (PAGE #2)

 

Select a Yoga Style:

Indoor

Outdoor

Under Water

 

Under Water selected Results: (PAGE #3)

 

-- Joes Under Water Yoga

-- Western Water World Yoga

-- Southern Yoga of the Sea

 

Am I making sense?

 

Anyone know of a decent tutorial or maybe provide some insight on the best method to write these link based searches?

 

Thanks in advance for anything

 

 

 

Hi DarkWater,

 

Thanks for the reply.

 

Yes I understand GET, but I was more looking for the most efficient way to do this. Also if I should use one .php page for all results, links, etc or separate pages for each link set type.

 

I'm not looking for someone to show me how to code it all out. I just was hoping to find a tutorial on this specific method of using GET and an expandable and efficient way of doing it.

 

Any ideas?

You'd use one PHP file.  How I'd really do this would be using mod_rewrite because of the fact that the URLs will get ugly really quickly and just parse out a single GET parameter.  I.E:

 

<?php
//pretend that you have it set up to send http://www.yoursite.com/search/yoga/underwater to http://www.yoursite.com/search.php?search=yoga/underwater

$params = explode('/', $_GET['search']);
$query = "SELECT * FROM table WHERE ";
foreach($params as $key=>$val) {
   $params[$key] = "category='$val'":
}
$query .= implode(" OR ", $params);
//do query and stuff

 

That's really simplified though.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.