Advertisement
Guest User

Untitled

a guest
Oct 9th, 2015
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.58 KB | None | 0 0
  1. <?php
  2. error_reporting(0);
  3. require_once 'conn_local.php';
  4.  
  5. $id = $_GET['id'];
  6.  
  7. $select = "SELECT * FROM list WHERE id='$id'";
  8.  
  9. $result_select = $conn->query($select);
  10. if(!$result_select){
  11. die('Błąd');
  12. }
  13. ?>
  14.  
  15. <link rel="stylesheet" type="text/css" href="css/table.css">
  16. <script type="text/javascript" src="jquery/jquery-1.10.2.min.js"></script>
  17. <script type="text/javascript" src="jquery/jquery.tablesorter.min.js"></script>
  18. <script type="text/javascript" src="js/table.js"></script>
  19. <body>
  20. <div id="wrapper">
  21. <h1>LISTA URZĄDZEŃ</h1>
  22.  
  23. <table id="keywords" cellspacing="0" cellpadding="0">
  24. <thead>
  25. <tr>
  26. <th><span>Rodzaj</span></th>
  27. <th><span>Model</span></th>
  28. <th><span>Procesor</span></th>
  29. <th><span>Dysk twardy</span></th>
  30. <th><span>RAM</span></th>
  31. <th><span>IP</span></th>
  32. <th><span>Klucz Windows</span></th>
  33. <th><span>Użytkownik</span></th>
  34. <th><span>Sprzedawca</span></th>
  35. <th><span>Nr faktury</span></th>
  36. <th><span>Data zakupu</span></th>
  37. <th><span>Cena netto</span></th>
  38. <th><span>Data modyfikacji</span></th>
  39.  
  40. </tr>
  41. </thead>
  42. <tbody>
  43.  
  44. <?php
  45. if($result_select->num_rows>0){
  46. while($row = $result_select->fetch_assoc()){
  47.  
  48. $hardware_type = $row['hardware_type'];
  49. $model = $row['model'];
  50. $processor = $row['processor'];
  51. $hard_drive = $row['hard_drive'];
  52. $ram = $row['ram'];
  53. $ip = $row['ip'];
  54. $win_key = $row['win_key'];
  55. $user = $row['user'];
  56. $seller = $row['seller'];
  57. $invoice_no = $row['invoice_no'];
  58. $order_date = $row['order_date'];
  59. $net_price = $row['net_price'];
  60. $date_modified = $row['date_modified'];
  61. ?>
  62. <form action="<?php echo 'test.php' ?>" method="post">
  63. <tr><td><input name="hardware_type" required size="10" value="<?php echo $hardware_type ?>"</td>
  64. <td><input name="model" required size="10" value="<?php echo $model ?>"></td>
  65. <td><input name="processor" required size="10"value="<?php echo $processor ?>"</td>
  66. <td><input name="hard_drive" required size="10" value="<?php echo $hard_drive ?>"</td>
  67. <td><input name="ram" required size="10" value="<?php echo $ram ?>"</td>
  68. <td><input name="ip" required size="10" value="<?php echo $ip ?>"</td>
  69. <td><input name="win_key" required size="10" value="<?php echo $win_key ?>"</td>
  70. <td><input name="user" required size="10" value="<?php echo $user ?>"</td>
  71. <td><input name="seller" required size="10" value="<?php echo $seller ?>"</td>
  72. <td><input name="invoice_no" required size="10" value="<?php echo $invoice_no ?>"</td>
  73. <td><input name="order_date" required size="10" value="<?php echo $order_date ?>"</td>
  74. <td><input name="net_price" required size="10" value="<?php echo $net_price ?>"</td>
  75. <td><input name="date_modified" required size="10" value="<?php echo $date_modified ?>"</td>
  76. <td><input name="submit" type="submit"</td>
  77. </form>
  78.  
  79.  
  80. <?php }
  81. }
  82.  
  83. $hardware_type = $_POST['hardware_type'];
  84. $model = $_POST['model'];
  85. $processor = $_POST['processor'];
  86. $hard_drive = $_POST['hard_drive'];
  87. $ram = $_POST['ram'];
  88. $ip = IP.$_POST['ip'];
  89. $win_key = $_POST['win_key'];
  90. $user = $_POST['user'];
  91. $seller = $_POST['seller'];
  92. $invoice_no = $_POST['invoice_no'];
  93. $order_date = $_POST['order_date'];
  94. $net_price = $_POST['net_price'];
  95. $date_modified = $_POST['date_modified'];
  96.  
  97. $update = "UPDATE list
  98. SET hardware_type = '$hardware_type',
  99. model = '$model',
  100. processor = '$processor',
  101. hard_drive = '$hard_drive',
  102. ram = '$ram',
  103. ip ='$ip',
  104. win_key = '$win_key',
  105. user = '$user',
  106. seller = '$seller',
  107. invoice_no = '$invoice_no',
  108. order_date = '$order_date',
  109. net_price = '$net_price',
  110. date_modified = '$date_modified'
  111. WHERE id = '$id'";
  112.  
  113. $result_update = $conn->query($update);
  114. if(!$result_insert){
  115. die($conn->error);
  116. }else{
  117. echo "<p class='info'>Zaktualizowano rekord</p>";
  118. }
  119. ?>
  120.  
  121. </tbody>
  122. </table>
  123. </div>
  124. </body>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement