Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- ini cuma tes.. tolong dienya di hapus
- echo "get<pre>";print_r($_GET);echo "</pre>";
- echo "POST<pre>";print_r($_POST);echo "</pre>";
- die();
- */
- //kl udah dapet variabel2nya.. comment 2 perintah di atas
- error_reporting(1); //kl 0 bener2 gk kelihatan.. kl mo liat error secara full 2047
- ?><html>
- <head>
- <title>View Data</title>
- </head>
- <body>
- <?php
- //if($_POST['id']){ << pake yang ini ga bisa mulu walau di ganti GET juga tetep ga bisa
- if(intval($_GET['id'])==1){
- echo "<table align='center'>";
- echo "<tr bgcolor='iceblue'>";
- echo "<td align='center'><font face='calibri' color='white'>";
- echo "No</td>";
- echo "<td align='center'><font face='calibri' color='white'>";
- echo "Id Produk</td>";
- echo "<td align='center'><font face='calibri' color='white'>";
- echo "Id Kategori</td>";
- echo "<td align='center'><font face='calibri' color='white'>";
- echo "Merk Produk</td>";
- echo "<td align='center'><font face='calibri' color='white'>";
- echo "Harga Beli</td>";
- echo "<td align='center'><font face='calibri' color='white'>";
- echo "Harga Jual Satuan</td>";
- echo "<td align='center'><font face='calibri' color='white'>";
- echo "Harga Jual Setengah Bungkus</td>";
- echo "<td align='center'><font face='calibri' color='white'>";
- echo "Harga Jual Satu Bungkus</td>";
- echo "<td align='center'><font face='calibri' color='white'>";
- echo "Jumlah Stok</td>";
- echo "<td align='center'><font face='calibri' color='white'>";
- echo "Choise</td>";
- echo "</tr>";
- $nomor = 0;
- $conn = mysql_connect("localhost","root","dancing01")or
- die(mysql_error()."Cannot connect to server");
- $data = mysql_select_db("warung", $conn)or
- die(mysql_error()."Cannot connect to database");
- $sql = "select * from master_produk ORDER BY id_kategori ASC";
- $result = mysql_query($sql, $conn)or
- die(mysql_error()."An error occure in SQL query <br> Query: $sql");
- while($line = mysql_fetch_row($result)){
- $nomor++;
- $id_produk = $line[0];
- $id_kategori = $line[1];
- $merk_produk = $line[2];
- $harga_beli = $line[3];
- $harga_jual_satuan = $line[4];
- $harga_jual_setengah_bks = $line[5];
- $harga_jual_satu_bks = $line[6];
- $jumlah_stok = $line[7];
- echo "<tr bgcolor='white'>";
- echo "<td align='center'> <font face='calibri' color='gray'>";
- echo "$nomor</td>";
- echo "<td align='center'> <font face='calibri' color='gray'>";
- echo "$id_produk</td>";
- echo "<td align='center'> <font face='calibri' color='gray'>";
- echo "$id_kategori</td>";
- echo "<td align='center'> <font face='calibri' color='gray'>";
- echo "$merk_produk</td>";
- echo "<td align='center'> <font face='calibri' color='gray'>";
- echo "$harga_beli</td>";
- echo "<td align='center'> <font face='calibri' color='gray'>";
- echo "$harga_jual_satuan</td>";
- echo "<td align='center'> <font face='calibri' color='gray'>";
- echo "$harga_jual_setengah_bks</td>";
- echo "<td align='center'> <font face='calibri' color='gray'>";
- echo "$harga_jual_satu_bks</td>";
- echo "<td align='center'> <font face='calibri' color='gray'>";
- echo "$jumlah_stok</td>";
- echo "<td align='center'>
- <a href='editData.php?id=$id_produk'><font face='calibri' color='gray'>";
- echo "Edit</a></td>";
- echo "</tr>";
- }
- echo "</tr>";
- echo "</table>";
- }
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement