Jump to content

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


steve m

Recommended Posts

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.
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
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?
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

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.