Commit 4920a4dc6ca0fc07e5ae848f9640032d7d479263

Authored by Edmar Moretti
1 parent 26d768ee

ajuste na importacao de arquivos csv

Showing 1 changed file with 7 additions and 2 deletions   Show diff stats
admin/php/metaestat_uploadcsv_submit.php
... ... @@ -91,7 +91,7 @@ error_reporting(0);
91 91 for ($i=0; $i<$testar;$i++){
92 92 $s = $linhas[$i];
93 93 $v = $s[$j];
94   - if(!is_numeric($v)){
  94 + if(!empty($v) && !is_numeric($v)){
95 95 $tipo = "varchar";
96 96 }
97 97 }
... ... @@ -125,7 +125,12 @@ error_reporting(0);
125 125 $vs[] = "'".$s[$j]."'";
126 126 }
127 127 else{
128   - $vs[] = $s[$j];
  128 + if(empty($s[$j])){
  129 + $vs[] = 'null';
  130 + }
  131 + else{
  132 + $vs[] = $s[$j];
  133 + }
129 134 }
130 135 }
131 136 $linhasql[] = $insert."VALUES(".implode(",",$vs).")";
... ...