What potential issues can arise when trying to append GET parameters in PHP?

When trying to append GET parameters in PHP, a potential issue that can arise is not properly encoding the parameters, which can lead to errors or security vulnerabilities. To solve this, it is important to use the `http_build_query()` function to properly encode the parameters before appending them to the URL.

$params = array(
    'param1' => 'value1',
    'param2' => 'value2'
);

$url = 'http://example.com/api?' . http_build_query($params);

echo $url;