note 19997 rejected from function.urlencode by didou
| From: | didou@php.net | Date: | Thu, 29 May 2003 21:05:01 +0000 |
| Subject: | note 19997 rejected from function.urlencode by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-49315@lists.php.net to get a copy of this message | ||
Note Submitter: sjohnson@fuzzygroup.com
----
//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 ...