Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- error_reporting(-1);
- mysql_connect("localhost", "root", "root");
- mysql_select_db("pln");
- $tim = $_POST['C_TIM'];
- $id_msk = $_POST['ID_MSK'];
- $kwh = $_POST['NO_KWH'];
- $tgl = $_POST['TGL_MSK'];
- $merk = $_POST['MERK'];
- $kd_brg = $_POST['KD_BRG'];
- $jml_msk = $_POST['JML_MSK'];
- $jumlah_data=count($kd_brg);
- for ($i=0; $i<$jumlah_data; $i++){
- if ((!empty($kd_brg[$i])) && (!empty($jml_msk[$i]))){
- $query = "INSERT INTO t_msk(ID_MSK, KD_BRG, TGL_MSK) VALUES ('$no', '".$kd_brg[$i]."', '$tgl')";
- $hasil = mysql_query($query) or die(mysql_error());
- $qry = "INSERT INTO td_msk(NO_MSK, NO_KWH, C_TIM, ID_MSK, JML_MSK) VALUES ('', '$kwh', '$tim', '$id_msk','".$jml_msk[$i]."')";
- $has = mysql_query($qry) or die(mysql_error());
- $kwh = "INSERT INTO t_meter VALUES ('$kwh', '0', '0', '$merk')";
- $hasq = mysql_query($kwh) or die(mysql_error());
- if ($hasil&&$has&&$hasq) {
- echo "Input data sukses<br>";
- } else {
- echo "Input data gagal<br>";
- }
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement