temen2 mohon bantuan'a , , , , jd gni,sy mau manggil script untuk penghapusan pada table dgn perintah : <a href="StokUbah.php?kdubah=<? echo $data['id_obat']; ?>"><img src=../icon/update.png border=0/></a> nah tp stlah sya msukan ke source code yg sya kerjakan kok malah eror,kira2 gmn ya? mohon bntuan'a. ini source table'a : <?php session_start(); include_once "../include2/librari.php"; include_once "../include2/session.php"; ?> <html> <head> <title>Daftar Obat</title> <link href="../css/css.css" media="screen" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="../js/jquery-1.5.1.min.js"></script> <script type="text/javascript"> // When document is ready: this gets fired before body onload :) $(document).ready(function(){ // Write on keyup event of keyword input element $("#kwd_search").keyup(function(){ // When value of the input is not blank if( $(this).val() != "") { // Show only matching TR, hide rest of them $("#my-table tbody>tr").hide(); $("#my-table td:contains-ci('" + $(this).val() + "')").parent("tr").show(); } else { // When there is no input or clean again, show everything back $("#my-table tbody>tr").show(); } }); }); // jQuery expression for case-insensitive filter $.extend($.expr[":"], { "contains-ci": function(elem, i, match, array) { return (elem.textContent || elem.innerText || $(elem).text() || "").toLowerCase().indexOf((match[3] || "").toLowerCase()) >= 0; } }); </script> </head> <?php include "../include2/header.html"; include "./include/koneksi2.php"; { ?> </div> <tr> <td id="tengah" valign="top"> <?php echo "<center>"; echo "<table>"; $batasan=5; // nilai awal utk kelipatan 5 $file="stoktampil.php"; $batas=$_GET['batas']; // limit yang dinamis $halaman=$_GET['halaman']; if(empty($halaman)){ $posisi=0; $halaman=1; } else{ $posisi = ($halaman-1) * $batas; } $tampil2="select a.id_obat, a.nama_obat, a.harga_jual, a.jumlah_stok, a.khasiat_obat, a.id_golongan, b.satuan, a.idlayanan from obat a, satuan_besar b where a.id_satuanb=b.id_satuanb group by b.id_satuanb"; $hasil2=mysql_query($tampil2); $jmldata=mysql_num_rows($hasil2); echo "<tr> <td align='center'><h2>Daftar Stok Obat</h2></td> </tr> <tr> <td align='center'><b><p>Jumlah keseluruhan : $jmldata Item</p></b></td> </tr>"; echo "<tr> <td><form method=get action='$file'> <input type=hidden name=halaman value=$halaman> Tentukan Tampilan Data Per Halaman: <select name=batas onChange='this.form.submit()'>"; for ($i=1;$i<=10;$i++){ $angka=$batasan*$i; if ($batas==$angka) echo "<option value=$angka selected>$angka</option>"; else echo "<option value=$angka>$angka</option>"; } echo "</select></form>"; ?>Search: <input type="text" id="kwd_search" value=""/><?php echo "</td></tr>"; // Langkah 1 if(empty($batas)){ $batas=$batasan; } else{ $batas=$batas; } // Langkah 2: Sesuaikan perintah SQL $tampil="select a.id_obat, a.nama_obat, a.harga_jual, a.jumlah_stok, a.khasiat_obat, a.id_golongan, b.satuan, a.idlayanan from obat a, satuan_besar b where a.id_satuanb=b.id_satuanb limit $posisi,$batas"; $hasil=mysql_query($tampil); echo "<tr> <td><table border='2' id='my-table' width='700px' align='center'> <thead><tr><th>No</th><th>ID</th><th>Nama Obat</th><th>Harga Jual</th><th>Jumlah Stok</th><th>Khasiat Obat</th><th>Golongan<th>Satuan</th><th>Layanan</th><th colspan=\"2\">Operasi</th></tr></thead>"; $no=$posisi+1; while ($data=mysql_fetch_array($hasil)){ $id_obat=$data["id_obat"]; if ($no%2==0) { $warna = "#ffffff"; } else { $warna = "#CBDCE2"; } echo "<tr bgcolor=".$warna.">"; if ($no<=400) { echo "<td align='center'>$no</td><td>$data[0]</td><td>$data[1]</td><td>Rp.$data[2]</td><td align='center'>$data[3]</td><td>$data[4]</td><td>$data[5]</td><td align='center'>$data[6]</td><td align='center'>$data[7]</td>"; echo "<td align='center'><button title='Ubah Data' style='width: 30px;'onClick=\"window.open('StokUbah.php?id_obat=".$id_obat."');\"><img src='../icon/update.png'/></td></button> <td align='center'><button title='Hapus' style='width: 30px;' onClick=\"window.open('form.php?id_obat=".$id_obat."');\"><img src='../icon/hapus.png'/></button></td> </tr>"; } $no ++; } echo "</table></tr></td>"; // Langkah 3: Hitung total data dan halaman serta link 1,2,3 ... echo "<tr> <td>Halaman : "; $jmlhalaman=ceil($jmldata/$batas); for($i=1;$i<=$jmlhalaman;$i++) if ($i != $halaman){ echo " <a href=$file?halaman=$i&batas=$batas>$i</A> | "; } else{ echo " <b>$i</b> | "; } echo "</td> </tr>"; echo "</table>"; echo "</center>"; } ?> </td> </tr> </table><?php include "../include2/footer.html";?> </body> </html> |
Muhammad Zikri 01 Jul, 2013
-
Source: http://www.facebook.com/groups/35688476100/?id=10151728343036101
--
Manage subscription | Powered by rssforward.com
Tidak ada komentar:
Posting Komentar