What are some common issues when trying to output database-fetched URLs as links in PHP?
One common issue when outputting database-fetched URLs as links in PHP is that the URLs may contain special characters or spaces that need to be properly encoded to ensure they work correctly in HTML. To solve this, you can use the `urlencode()` function to encode the URLs before outputting them as links.
<?php
// Fetch URL from database
$url = "http://example.com/page with spaces";
// Encode the URL
$encoded_url = urlencode($url);
// Output the URL as a link
echo '<a href="' . $encoded_url . '">Link</a>';
?>