Jump to content

Archived

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

steve m

wanting to know if you can pass "like" in a URL

Recommended Posts

I was wondering how to pass the "like" command in a URL. Is this possible?

For example: /equip_list.php?item_code=SONIC&sub_cat[b]like[/b]app%

I tried to do that and it didn't come up with the right results.

Share this post


Link to post
Share on other sites
How did you try to do it and what results did you get/expect. You can pass what ever you like in the URL. How you use it is up to you.

Ken

Share this post


Link to post
Share on other sites
I tried this: [a href=\"http://www.rcubed.com/equip_list.php?item_code=SONIC&sub_catlikeapp%\" target=\"_blank\"]http://www.rcubed.com/equip_list.php?item_...sub_catlikeapp%[/a] and it came up with about 181 results, where it should only come up with about 30 - 40 results.

Share this post


Link to post
Share on other sites
how are you sending the Search to the URL first of all
and secondly what code are you using to Search from the url

helps more if you provide some code


my guess is that when you are searching from what's shown in the URL
you're assuming subcat is always equal to it's value
it that's the problem you should have it look at the value.....(likeapp%)...first and then
tell it to say.....
WHERE subcat LIKE 'app%'
instead of
WHERE subcat = 'likeapp%'

LIKE works just as good as equals...especially when you're going to be using wildcards

Share this post


Link to post
Share on other sites
here is the url that I'm trying to pass.

[a href=\"http://www.rcubed.com/equip_list.php?item_code=SONIC&sub_catlikeapp%\" target=\"_blank\"]http://www.rcubed.com/equip_list.php?item_...sub_catlikeapp%[/a]

for some reason it doesn't like that. It's selecting more records than it should. How can you use a wildcard in a url?

Share this post


Link to post
Share on other sites
somewhere in your equip_list.php file
you are telling it to do something like this I assume

[code]$sql = "SELECT * FROM sometable WHERE subcat = '" . $_GET['subcat'] . "'";[/code]

you need to have it do this instead

[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]$sql = "SELECT * FROM sometable WHERE subcat [b]LIKE [/b]'" . $_GET['subcat'] . "'";[/quote]

so just change you link to go to
[a href=\"http://www.rcubed.com/equip_list.php?item_code=SONIC&sub_cat=app%\" target=\"_blank\"]http://www.rcubed.com/equip_list.php?item_...IC&sub_cat=app%[/a]
after you have changed your PHP script

Share this post


Link to post
Share on other sites

×

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.