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.
Link to comment
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
Link to comment
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?
Link to comment
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

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.