I\'m having an issue with special characters for addresses from my database for google geocode, but not if I hardcode them.
Simple geocode code
$url = \"
Try urlencode for database output data
urlencode
Like
$address = urlencode($row['address'])
Also remove this $address = str_replace(" ","+",$address); from current code.
$address = str_replace(" ","+",$address);