Advertisement
GWibisono

testing script

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