For instances such as our check_if_exists(), SQLite also introduces sqlite_single_query() that can be used to combine data retrieval with query execution.

<?php
function check_if_exists($cc)
{
    return sqlite_single_query(
        "SELECT id FROM country_data WHERE cc_code_2='{$cc}'", 
        sqlite_r
    );
}
?>