Jump to content


Photo

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


  • Please log in to reply
6 replies to this topic

#1 steve m

steve m
  • Members
  • PipPipPip
  • Advanced Member
  • 50 posts

Posted 07 April 2006 - 03:00 PM

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

For example: /equip_list.php?item_code=SONIC&sub_catlikeapp%

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

#2 kenrbnsn

kenrbnsn
  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 07 April 2006 - 03:18 PM

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

#3 steve m

steve m
  • Members
  • PipPipPip
  • Advanced Member
  • 50 posts

Posted 07 April 2006 - 03:41 PM

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.

#4 Zane

Zane
  • Administrators
  • Advanced Member
  • 4,134 posts

Posted 07 April 2006 - 03:45 PM

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

btn_donate_SM.gif Want to thank me? Contribute to my PayPal piggy-bank
 

172938.png

#5 steve m

steve m
  • Members
  • PipPipPip
  • Advanced Member
  • 50 posts

Posted 07 April 2006 - 03:57 PM

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?

#6 Zane

Zane
  • Administrators
  • Advanced Member
  • 4,134 posts

Posted 07 April 2006 - 04:07 PM

somewhere in your equip_list.php file
you are telling it to do something like this I assume

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

you need to have it do this instead

[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]$sql = "SELECT * FROM sometable WHERE subcat LIKE '" . $_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


btn_donate_SM.gif Want to thank me? Contribute to my PayPal piggy-bank
 

172938.png

#7 steve m

steve m
  • Members
  • PipPipPip
  • Advanced Member
  • 50 posts

Posted 07 April 2006 - 08:29 PM

Yeah, it's probably the problem. Thanks a lot.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users