<?php
    include_once '../../config/config-local.php';
    include_once '../../models/database.php';
    include_once 'countries_array.php';
    
    $array = array();
    $count = 0;
    $keys = array_keys( $countries );
  
    foreach ( $keys as $key ) {
        $value = $countries[ $key ];
        $array[] = "INSERT INTO 
                        `countries` (`id`, `country`, `shortname`) 
                    VALUES 
                        (NULL, '$value', '$key');";
    }
    
    foreach( $array as $sql ) {
        $res = mysql_query( $sql );
        if ( $res === false ) {
            die( "sql query died with the following error\n\"" . mysql_error() );
        }
        ++$count; 
    }
    
    echo "You imported $count raws in the table 'countries'.";
?>


<?php
    include_once '../../config/config-local.php';
    include_once '../../models/database.php';
    include_once '../../models/db.php';
    include_once 'countries_array.php';
    
    $countries = getCountries();
    $array = array();
    $count = 0;
    $keys = array_keys( $countries );
  
    foreach ( $keys as $key ) {
        $value = $countries[ $key ];
        $res = db_insert( 'countries', array( 'id' => NULL, 'country' => $value, 'shortname' => $key ) );
        if ( $res === false ) { 
            die( "sql query died with the following error\n\"" . mysql_error() );
        }
        ++$count;
    }
    
    echo "You imported $count raws in the table 'countries'.";
?>


Use fixed queries for population script
Use fixed queries for population script
