drimlen

editData.php

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