mrpatg
mrpatg

Reputation: 10117

how to define variable from mysql output

I have the following variable which returns my URL as needed. But i need to run str_replace() on it to replace a character before echoing it into my HTML code.

$url = str_replace("%3A", ":", " . nl2br( $row['url']) . ");

As it stands the " . nl2br( $row['url']) . " contains %3A instead of the colon in the URL and for some reason its rendering my links like this

http://www.mydomain.com/http%3A//url.com

Upvotes: 0

Views: 305

Answers (1)

jimyi
jimyi

Reputation: 31231

I'm not really sure what your question is, but it looks like this is what you want:

$url = urldecode($row['url']);

The %3A is a URL encoded colon (:).

Upvotes: 3

Related Questions