コード例 #1
0
 	$JML12		= $Item->Fields(20);
 	
 	$sql = "INSERT INTO d_trktrm(THANG, KDSATKER, KDDEPT, KDUNIT, KDPROGRAM, KDGIAT, RPHPAGU, KDTRKTRM, JNSBELANJA, JML01, JML02, JML03, 
 	JML04, JML05, JML06, JML07, JML08, JML09, JML10, JML11, JML12) VALUES ('".$THANG."', '".$KDSATKER."', '".$KDDEPT."', '".$KDUNIT."', 
 	'".$KDPROGRAM."', '".$KDGIAT."', '".$RPHPAGU."', '".$KDTRKTRM."', '".$JNSBELANJA."', '".$JML01."', '".$JML02."', '".$JML03."', 
 	'".$JML04."', '".$JML05."', '".$JML06."', '".$JML07."', '".$JML08."', '".$JML09."', '".$JML10."', '".$JML11."', '".$JML12."')";
 	
 	mysql_query($sql);
     				$Item->MoveNext();
 }
 
 $Item->Close();
 */
 $table_7 = new XBaseTable($tabel_7);
 $table_7->open();
 while ($record = $table_7->nextRecord()) {
     foreach ($table_7->getColumns() as $i => $c) {
         if ($c->getName() == "THANG") {
             $THANG = $record->getString($c);
         } else {
             if ($c->getName() == "KDSATKER") {
                 $KDSATKER = $record->getString($c);
             } else {
                 if ($c->getName() == "KDDEPT") {
                     $KDDEPT = $record->getString($c);
                 } else {
                     if ($c->getName() == "KDUNIT") {
                         $KDUNIT = $record->getString($c);
                     } else {
                         if ($c->getName() == "KDPROGRAM") {
                             $KDPROGRAM = $record->getString($c);
コード例 #2
0
ファイル: queue.php プロジェクト: raymerta/Monev
 function execute($id)
 {
     $row = $this->db->from('tb_upload')->where('id', $id)->get()->row();
     $path = getcwd() . '/tmp/';
     $filename = $row->filename;
     if (!file_exists($path . DIRECTORY_SEPARATOR . $row->code)) {
         echo mkdir($path . DIRECTORY_SEPARATOR . $row->code);
     }
     $this->_extract($path . $filename, $path . $row->code);
     $dir = scandir($path . $row->code);
     //echo 'path : '.$path.'<br>';
     //echo 'filename : '.$filename.'<br>';
     //echo 'row code : '.$row->code.'<br>';
     //print_r($dir);
     require_once './prodigy-dbf.php';
     /* load the required classes */
     require_once "phpxbase/Column.class.php";
     require_once "phpxbase/Record.class.php";
     require_once "phpxbase/Table.class.php";
     $sql = $sql2 = '';
     $this->db->query('USE staging_monev');
     $nullflags = 0;
     //foreach ($dir as $v) {
     //echo count($dir);
     for ($i = 2; $i < count($dir); $i++) {
         $exploded = explode($row->code, $dir[$i]);
         //echo ' <br> dudi : '.$exploded[0];
         /* buat object table dan buka */
         if (substr($exploded[0], -3) != "FPT" && $exploded[0] != "t_versi.DBF") {
             $table = new XBaseTable('tmp/' . $row->code . '/' . $exploded[0] . $row->code);
             $table->open();
             /*Create table */
             $create_table = "create table if not exists " . $exploded[0] . " ( ";
             $fields = $table->getColumns();
             for ($t = 0; $t < count($fields); $t++) {
                 $j = count($fields) - 1;
                 switch ($fields[$i]->type) {
                     case "C":
                         $type = "char";
                         break;
                     case "N":
                         $type = "varchar";
                         break;
                 }
                 if ($t == $j) {
                     $create_table .= $fields[$t]->name . " " . $type . "(" . $fields[$t]->length . ") null ";
                 } else {
                     $create_table .= $fields[$t]->name . " " . $type . "(" . $fields[$t]->length . ") null, ";
                 }
             }
             $create_table .= ");";
             //echo $create_table;
             $this->db->query($create_table);
             //insert data of table X
             while ($record = $table->nextRecord()) {
                 //$field = $table->getColumns();
                 $data = $record->choppedData;
                 $value_of_field = "'" . $data[0] . "'";
                 for ($val = 1; $val < count($data); $val++) {
                     $value_of_field .= ",'" . $data[$val] . "'";
                 }
                 $sql = "INSERT INTO " . $exploded[0] . " VALUES ({$value_of_field});";
                 $this->db->query($sql);
                 //echo $sql;
             }
             //end while
             $table->close();
         }
     }
     $this->db->update('db_monev.tb_upload', array('is_done' => true), array('id' => $id));
     redirect(site_url() . 'backend/queue');
 }