A fast (not elegant) way to get an array of the countries iso codes and country ID from opencart. I just needed them to compare the data with an external source.
Just put the file in the Opencart folder (ex. arrayp.php).
I know that it's crap ...
<?php
$newpassword='admin';
require('config.php');
$dbconn = mysqli_connect(DB_HOSTNAME,DB_USERNAME,DB_PASSWORD) or die("Cannot connect to the database");
mysqli_select_db($dbconn, DB_DATABASE) or die($dbconn->error());
$sql_q = "SELECT CONCAT( '\'', `iso_code_2`, '\' => \'',`country_id`, '\', ' ) as arrcodes FROM `" . DB_PREFIX . "country`;";
$result = mysqli_query($dbconn, $sql_q);
if( !$result){ die($dbconn->error); }
echo '$mycountries = array(' . "\r\n";
// $queryResult = array();
while($mres = $result->fetch_object()){
echo "\t" . $mres->arrcodes . "\r\n";
}
$result->close();
echo ");";
// echo 'Done';
Comments
Post a Comment