note 19997 added to function.urlencode
| From: | sjohnson at fuzzygroup dot com | Date: | Mon, 18 Mar 2002 17:20:19 +0000 |
| Subject: | note 19997 added to function.urlencode | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-27916@lists.php.net to get a copy of this message | ||
//to put in db:
//encode the url so that + character
//doesn't become a space in the db
$url=urlencode($url);
$url=mysql_escape_string($url);
And then:
//to retrieve from db:
$url=urldecode($url);
$url = str_replace(" ", "+", $url);
The str_replace call is strange but needed. I don't 100% understand the details as to why this
works but it seems to work well and be reliable. A little thought and it would probably be clear
but I'm rushed ...
--
http://www.php.net/manual/en/function.urlencode.php
http://master.php.net/manage/user-notes.php?action=edit+19997
http://master.php.net/manage/user-notes.php?action=delete+19997
http://master.php.net/manage/user-notes.php?action=reject+19997