Postingan lainnya
Buku Ini Koding!
Baru!
Buku ini akan jadi teman perjalanan kamu belajar sampai dapat kerjaan di dunia programming!
Tidak Bisa Insert Ke Database (PHP MYSQL)
Aksi tambah . Php
<?php
include ("../config/koneksi.php");
include ("../config/fungsi_thumb.php");
if($_GET['module']=='tambahantri'){
$kodepas=$_POST['kodepasien'];
$namapas=$_POST['namapasien'];
$jam=time('jam');
$tanggal=$_POST['tanggal'];
$cek=mysql_query("SELECT * FROM antrian WHERE kodePasien");
$num=mysql_num_rows($cek);
if($num>=1){
echo "<script>
alert('Data pasien sudah terdaftar!');
window.location.href='../home.php?module=daftarpasien';
</script>";
}
else{
$query=mysql_query("INSERT INTO antrian (kodePasien,nama_pasien,tgl_antri,jampanggil,tanggalpanggil) VALUES ('$kodepas','$namapas','$jam','$tanggal')");
header("location:../home.php?module=daftarpasien");
}
}
?>
Input ke database . Php
<a data-toggle="modal" class="btn btn-success" href="#setwaktu-<?php echo $no;?>"><i class="icon-calendar icon-white"></i>Set Waktu</a>
</div></td>
<div id="setwaktu-<?php echo $no;?>" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-body">
<h3>OPSI WAKTU PANGGIL ANTRIAN</h3>
<form method="post" enctype="multipart/form-data" action="<?php echo "$aksi?module=tambahantri";?>">
Kode Pasien :<div class="pull-right">
<input type="hidden" name="kodepasien" value="<?php echo $kodepasien;?>">
<input type="text" value="<?php echo $kodepasien;?>" disabled>
</div>
<br>
<br>Nama Pasien :<div class="pull-right">
<input type="hidden" name="namapasien" value="<?php echo $nama_pasien;?>">
<input type="text" value="<?php echo $nama_pasien;?>" disabled>
</div>
<br>
<br>Tentukan Jam :<div class="pull-right">
<input type="time" name="jam">
</div>
<br>
<br>Tentukan Tanggal :<div class="pull-right">
<input type="date" name="tanggal">
</div>
<br><br>
<div class="pull-right">
<button type="submit" class="btn btn-success pull-right"><i class="icon-plus icon-white"></i>Tambah Antri</button>
</div>
</form>
</div>
</div>
Minta pencerahannya para abang2 sekalian.. Source code sudah di ambil yg tidak bisa sj.. padahal menurut sy udh bnr, tp ndak bisa nambah ke database..
0
2 Jawaban:
Ndak ada pesan error pak. Redirectnya juga tidak ada masalah. Tp di database data inputnya tirak ada
0