Can’t get full post title if there a spaces in title

Damn, I came with a solution after I posted it….

echo ' <a href="http://www.bing.com/search?q=' . urlencode($titletest) . '">' . $titletest . '</a>';

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