Tuesday, June 12, 2018
Opencart create a php array of the countries IDs
Opencart create a php array of the countries IDs
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 its 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( . " ";
// $queryResult = array();
while($mres = $result->fetch_object()){
echo " " . $mres->arrcodes . " ";
}
$result->close();
echo ");";
// echo Done;