Howlin1 Posted August 28, 2011 Share Posted August 28, 2011 Hello, Say I have a url http://www.somedomain.com/abc/view.php?id=Mountain--troll---D&D--2- And "Mountain troll -D&D 2-" is an entry in a database with information. The problem that I am having is since I have an ampersand in the url it is being treated as two different strings (Mountain troll -D being one and 2- being the second). I know I can solve the problem by just not using an ampersand in the database entry name, but for arguments sakes lets say I can't remove it. Would it be possible for it to be treated as one long string ignoring the ampersand? Link to comment https://forums.phpfreaks.com/topic/245917-using-in-a-url/ Share on other sites More sharing options...
Pikachu2000 Posted August 28, 2011 Share Posted August 28, 2011 Refer to this thread: http://www.phpfreaks.com/forums/index.php?topic=342556.0 Link to comment https://forums.phpfreaks.com/topic/245917-using-in-a-url/#findComment-1262961 Share on other sites More sharing options...
Dusaro Posted August 29, 2011 Share Posted August 29, 2011 Its used instead of a Space or a Separator. Correct me if im wrong. Link to comment https://forums.phpfreaks.com/topic/245917-using-in-a-url/#findComment-1263085 Share on other sites More sharing options...
silkfire Posted August 29, 2011 Share Posted August 29, 2011 Howlin1, use the handy urlencode() function: echo urlencode('Mountain--troll---D&D--2-'); // Mountain--troll---D%26D--2- Link to comment https://forums.phpfreaks.com/topic/245917-using-in-a-url/#findComment-1263136 Share on other sites More sharing options...
Howlin1 Posted August 29, 2011 Author Share Posted August 29, 2011 Thanks works like a charm! Link to comment https://forums.phpfreaks.com/topic/245917-using-in-a-url/#findComment-1263211 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.