php parse_url reverse — parsed url

These are the two functions I use for decomposing and rebuilding URLs: function http_parse_query($query) { $parameters = array(); $queryParts = explode(‘&’, $query); foreach ($queryParts as $queryPart) { $keyValue = explode(‘=’, $queryPart, 2); $parameters[$keyValue[0]] = $keyValue[1]; } return $parameters; } function build_url(array $parts) { return (isset($parts[‘scheme’]) ? “{$parts[‘scheme’]}:” : ”) . ((isset($parts[‘user’]) || isset($parts[‘host’])) ? ‘//’ … Read more

Parse an URL in JavaScript

You can use a trick of creating an a-element, add the url to it, and then use its Location object. function parseUrl( url ) { var a = document.createElement(‘a’); a.href = url; return a; } parseUrl(‘http://example.com/form_image_edit.php?img_id=33’).search Which will output: ?img_id=33 You could also use php.js to get the parse_url function in JavaScript. Update (2012-07-05) I … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)