Advertisement
GWibisono

Untitled

May 25th, 2012
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.45 KB | None | 0 0
  1. <?php
  2. /*
  3. ini cuma tes.. tolong dienya di hapus
  4. */
  5. echo "get<pre>";print_r($_GET);echo "</pre>";
  6. echo "POST<pre>";print_r($_POST);echo "</pre>";
  7. die();
  8. //kl udah dapet variabel2nya.. comment 2 perintah di atas
  9. error_reporting(1); //kl 0 bener2 gk kelihatan.. kl mo liat error secara full 2047
  10. ?><html>
  11.  
  12. <head>
  13.   <title>View Data</title>
  14. </head>
  15.  
  16. <body>
  17.  
  18. <?php
  19. //if($_POST['id']){ << pake yang ini ga bisa mulu walau di ganti GET juga tetep ga  bisa
  20.     if(intval($_GET['id'])==1){
  21.         echo"<table align=\"center\">";
  22.         echo"<tr bgcolor=\"iceblue\">";
  23.     echo"<td align=\"center\"><font face=\"calibri\" color=\"white\">";
  24.     echo"No</td>";
  25.     echo"<td align=\"center\"><font face=\"calibri\" color=\"white\">";
  26.     echo"Id Produk</td>";
  27.     echo"<td align=\"center\"><font face=\"calibri\" color=\"white\">";
  28.     echo"Id Kategori</td>";
  29.     echo"<td align=\"center\"><font face=\"calibri\" color=\"white\">";
  30.     echo"Merk Produk</td>";
  31.     echo"<td align=\"center\"><font face=\"calibri\" color=\"white\">";
  32.     echo"Harga Beli</td>";
  33.     echo"<td align=\"center\"><font face=\"calibri\" color=\"white\">";
  34.     echo"Harga Jual Satuan</td>";
  35.         echo"<td align=\"center\"><font face=\"calibri\" color=\"white\">";
  36.         echo"Harga Jual Setengah Bungkus</td>";
  37.                 echo"<td align=\"center\"><font face=\"calibri\" color=\"white\">";
  38.         echo"Harga Jual Satu Bungkus</td>";
  39.         echo"<td align=\"center\"><font face=\"calibri\" color=\"white\">";
  40.         echo"Jumlah Stok</td>";
  41.         echo"<td align=\"center\"><font face=\"calibri\" color=\"white\">";
  42.         echo"Choise</td>";
  43.         echo"</tr>";           
  44.  
  45.  
  46.     $nomor = 0;
  47.  
  48.     $conn = mysql_connect("localhost","root","dancing01")or
  49.         die(mysql_error()."Cannot connect to server");
  50.  
  51.         $data = mysql_select_db("warung", $conn)or
  52.             die(mysql_error()."Cannot connect to database");
  53.  
  54.             $sql = "select * from master_produk ORDER BY id_kategori ASC";
  55.             $result = mysql_query($sql, $conn)or
  56.                 die(mysql_error()."An error occure in SQL query <br> Query: $sql");
  57.  
  58.         while($line = mysql_fetch_row($result)){
  59.  
  60.             $nomor++;
  61.  
  62.             $id_produk = $line[0];
  63.             $id_kategori = $line[1];
  64.             $merk_produk = $line[2];
  65.                 $harga_beli = $line[3];
  66.                 $harga_jual_satuan = $line[4];
  67.                 $harga_jual_setengah_bks = $line[5];
  68.                 $harga_jual_satu_bks = $line[6];
  69.                 $jumlah_stok = $line[7];
  70.  
  71.                 echo"<tr bgcolor=\"white\">";
  72.                     echo"<td align=\"center\"> <font face=\"calibri\" color=\"gray\">";
  73.                     echo"$nomor</td>";
  74.                     echo"<td align=\"center\"> <font face=\"calibri\" color=\"gray\">";
  75.                     echo"$id_produk</td>";
  76.                     echo"<td align=\"center\"> <font face=\"calibri\" color=\"gray\">";
  77.                     echo"$id_kategori</td>";
  78.                     echo"<td align=\"center\"> <font face=\"calibri\" color=\"gray\">";
  79.                     echo"$merk_produk</td>";
  80.                     echo"<td align=\"center\"> <font face=\"calibri\" color=\"gray\">";
  81.                     echo"$harga_beli</td>";
  82.                     echo"<td align=\"center\"> <font face=\"calibri\" color=\"gray\">";
  83.                     echo"$harga_jual_satuan</td>";
  84.                     echo"<td align=\"center\"> <font face=\"calibri\" color=\"gray\">";
  85.                     echo"$harga_jual_setengah_bks</td>";
  86.                     echo"<td align=\"center\"> <font face=\"calibri\" color=\"gray\">";
  87.                     echo"$harga_jual_satu_bks</td>";
  88.                     echo"<td align=\"center\"> <font face=\"calibri\" color=\"gray\">";
  89.                     echo"$jumlah_stok</td>";
  90.                     echo"<td align=\"center\"> <a href=\"editData.php\"><font face=\"calibri\" color=\"gray\">";
  91.                     echo"Edit</td>";
  92.                 echo"</tr>";
  93.                 }
  94.  
  95.                 echo"</tr>";
  96.                 echo"</table>";
  97.     }
  98. ?>
  99.  
  100. </body>
  101.  
  102. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement