Use parameter to filter results in a database without directly allowing users to access database
It's completely unnecessary to execute the request SELECT slug FROM countries only to verify the user input before running SELECT countryid, name FROM countries WHERE slug = :slug LIMIT 1.
You can safely use the user input in the second query directly.
This is thanks to using prepared statements.
Even if the user input is malicious, PDO prevents SQL injection.

In other words, the first part of your snippet could be simply this:

if (isset($_GET['l'])) {
    $location = strip_tags($_GET['l']);
    $sql = "SELECT countryid, name FROM countries WHERE slug = :slug LIMIT 1";
    $matchCountry = $db-&gt;prepare($sql);
    $matchCountry-&gt;execute(array(':slug' =&gt; $location));
    $countryDetails = $matchCountry-&gt;fetch(PDO::FETCH_ASSOC);
}


If your main goal is to do SELECT * FROM items,
then if items.countryid is indexed, and countries.countryid is indexed,
then it would be best to write a single JOIN:

SELECT items.* FROM items JOIN countries USING (countryid)
WHERE items.suspend = 0 AND countries.slug = :slug GROUP BY items.id


This optimizes performance with the fewest necessary queries, without compromising safety.

However, it's recommended to avoid SELECT * queries, and always specify the fields you want to fetch explicitly.