/DEV/DISPLAY/flux/generateLocalitiesList.php
PHP | 53 lines | 31 code | 5 blank | 17 comment | 7 complexity | b57d3cf3800a7d31dc15bc20056e017c MD5 | raw file
- <?php
-
- /**
- *
- * $query = "SELECT DISTINCT lgn_id
- FROM db1.T_LOCALITY_LCT_FR
- WHERE lct_name LIKE '$data[$c]%'";
- *
- *
- *
- *
- *
- */
- require_once('../modules/includes.php');
- // Chemin du fichier ini
- $file = dirname(__FILE__) . "/conf/test.csv";
- $result = NULL;
- $row = 0;
- $temp = NULL;
-
- print_r("resultat: \n");
-
- if (($handle = fopen($file, 'r')) !== FALSE) {
- while (($data = fgetcsv($handle, ',')) !== FALSE) {
- //champs
- $num = count($data);
- //lignes
- //$row++;
- $c = 0;
-
- while ($c < $num) {
- $query = "SELECT lgn_id,lct_name,lct_id
- FROM db1.T_LOCALITY_LCT_FR
- WHERE lct_name LIKE '$data[$c]%'";
- $result = pdoquery($query);
-
- foreach ($result as $k => $v) {
- if ($v['lgn_id']) {
- //ignore
- if ($temp != $v['lgn_id']) {
- print_r("$v[lgn_id],");
- $temp = $v['lgn_id'];
- }
- } else {
- //print_r("$v[lct_id],");
- }
- }
- $c++;
- }
- }
- fclose($handle);
- }
- ?>