member123 Posted May 10, 2008 Share Posted May 10, 2008 I use a feed reader called Feed on Feeds that uses PHP/MySQL. It has a feature that lets you define some words to automatically tag, and if a new post comes in with those words in it, they get tagged. I have several words set up, including some that are multiple words (e.g. Steve Jobs). They get tagged fine. When I check in the database, the articles include those tags. When you sort by tag in the reader, it goes to a URL like this: http://www.domain.com/?what=Apple and then a GET function takes the Apple and displays all articles with that tag. When you sort by a tag that is multiple words, you get something like http://www.domain.com/?what=Steve%20Jobs. That doesn't load any of the tags, possibly because of the %20 conversion. I've tried going into the function where this appears: if(!isset($_GET['what'])) { $what = "unread"; } else { $what = $_GET['what']; } and replacing it with: if(!isset($_GET['what'])) { $what = "unread"; } else { $what = urldecode($_GET['what']); } but unfortunately that didn't solve the problem. I also tried changing it to this, just to get a better idea of what was causing the problem: if(!isset($_GET['what'])) { $what = "unread"; } else { $what = "Steve Jobs"; } When it was changed to that, clicking on any tag, even a one-word tag, should bring up all of the articles that are tagged "Steve Jobs". Anybody know what is going wrong, or if I am making a stupid mistake or something? Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/105068-20-percent-sign-space-causing-problems-with-php/ Share on other sites More sharing options...
DeanWhitehouse Posted May 10, 2008 Share Posted May 10, 2008 change steve jobs to steve_jobs Quote Link to comment https://forums.phpfreaks.com/topic/105068-20-percent-sign-space-causing-problems-with-php/#findComment-537851 Share on other sites More sharing options...
member123 Posted May 10, 2008 Author Share Posted May 10, 2008 I don't think that will work, because the posts aren't tagged as Steve_Jobs. Quote Link to comment https://forums.phpfreaks.com/topic/105068-20-percent-sign-space-causing-problems-with-php/#findComment-537860 Share on other sites More sharing options...
LooieENG Posted May 10, 2008 Share Posted May 10, 2008 str_replace('%20', ' ', $_GET['what']) ? Quote Link to comment https://forums.phpfreaks.com/topic/105068-20-percent-sign-space-causing-problems-with-php/#findComment-537889 Share on other sites More sharing options...
member123 Posted May 11, 2008 Author Share Posted May 11, 2008 str_replace('%20', ' ', $_GET['what']) ? Hi Looie, that was actually one of the first things I tried. I had an if statement check of the tag contains a %20, and then I used your code to replace the %20 with a space. Unfortunately, it didn't work. The problem seems to be somewhere else in the code. Even when I hard code the space, I can't sort by tags with spaces in them. Quote Link to comment https://forums.phpfreaks.com/topic/105068-20-percent-sign-space-causing-problems-with-php/#findComment-537952 Share on other sites More sharing options...
member123 Posted May 11, 2008 Author Share Posted May 11, 2008 Update: I'll give $5 through PayPal to whoever helps me get to the bottom of this. Quote Link to comment https://forums.phpfreaks.com/topic/105068-20-percent-sign-space-causing-problems-with-php/#findComment-538050 Share on other sites More sharing options...
DarkWater Posted May 11, 2008 Share Posted May 11, 2008 After you urldecode it, echo it out and make sure it's a space. Then I'll try to help from there. For free. (I only saw the topic now, otherwise I would have helped earlier. I don't think you should have to pay for someone to offer their knowledge and help you better your skills.) Quote Link to comment https://forums.phpfreaks.com/topic/105068-20-percent-sign-space-causing-problems-with-php/#findComment-538054 Share on other sites More sharing options...
member123 Posted May 11, 2008 Author Share Posted May 11, 2008 Thanks, let me try that out. Quote Link to comment https://forums.phpfreaks.com/topic/105068-20-percent-sign-space-causing-problems-with-php/#findComment-538570 Share on other sites More sharing options...
member123 Posted May 12, 2008 Author Share Posted May 12, 2008 I set up the echos, and it has the correct spaces with and without urldecode(). So it probably isn't the %20 that is actually causing the problem, but some other area where the spaces are screwing things up. Quote Link to comment https://forums.phpfreaks.com/topic/105068-20-percent-sign-space-causing-problems-with-php/#findComment-538630 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.