diff --git a/action.php b/action.php index 183c8b6..232a745 100644 --- a/action.php +++ b/action.php @@ -72,10 +72,14 @@ if ($action=='load') { //pour le md5 on ne tient pas compte du Solde du sens et du libellé de l'activité + unset($getData[1]); + unset($getData[5]); unset($getData[9]); unset($getData[10]); unset($getData[12]); ; + //var_dump($getData); + //exit(); $checkmd5=hash('md5',serialize($getData)); // Get row data @@ -120,7 +124,7 @@ if ($action=='load') $check = mysqli_query($conn, $query); $row = mysqli_fetch_row($check); $num = $row[0]; - + //$num=0; if ($num==0) { @@ -232,5 +236,46 @@ if (count($data) > 0) { } } } +elseif ($action=='update_checkmd5') +{ + + $query="ALTER TABLE importation_data_aidimpact ADD idt int not null auto_increment primary key AFTER checkmd5;"; + + //$query="SELECT idt,md5(concat(IFNULL(no_compte,''),IFNULL(code_JNL,''),IFNULL(No_piece,''),IFNULL(date_piece,''),IFNULL(lib_mouvement,''),IFNULL(debit,''),IFNULL(credit,''),IFNULL(code_activite,''))) as checkmd5 from importation_data_aidimpact;"; + $query="SELECT idt,no_compte,code_JNL,No_piece,date_piece,lib_mouvement,debit,credit,code_activite from importation_data_aidimpact;"; + + + $result=mysqli_query($conn, $query); + + $data = array(); + if (mysqli_num_rows($result) > 0) { + while ($row = mysqli_fetch_assoc($result)) { + $row2 = $row; + unset($row2["idt"]); + + + $checkmd5=hash('md5',serialize($row2)); + $query="update importation_data_aidimpact set checkmd5='".$checkmd5."' where idt=".$row["idt"].";"; + $result=mysqli_query($conn, $query); + } + } + + +$query="select idt,checkmd5 from importation_data_aidimpact"; +//$query="select no_compte,CONCAT(no_compte,lib_compte,code_JNL,No_piece,date_piece,lib_mouvement,debit,credit,code_activite) as checkmd5 from importation_data_aidimpact"; +$result=mysqli_query($conn, $query); +$data = array(); + if (mysqli_num_rows($result) > 0) { + while ($row = mysqli_fetch_assoc($result)) { + $data[] = $row; + } + } + var_dump($data); + echo "

update checkmd5 done !" ; +} +else +{ + echo "action error"; +} ?> \ No newline at end of file