Guest User

Untitled

a guest
Jan 2nd, 2019
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.02 KB | None | 0 0
  1. CODE # 1 start
  2. <!DOCTYPE html>
  3. <html>
  4. <head>
  5. <title></title>
  6. </head>
  7. <body>
  8. <form class="create_invoice" method="POST">
  9. <span id="c">#Code</span>
  10. <span id="n">Name</span>
  11. <span id="t">Type</span>
  12. <span id="co">Company</span>
  13. <span id="u">Unit price</span>
  14. <span id="q">Quantity</span>
  15. <span id="t">Total Price</span>
  16.  
  17. <table class="create_table" id="new_row">
  18. <tr>
  19. <td><input id="cod" class="code" type="text" name="code" value="f800"></td>
  20.  
  21. <td><input id="in" class="name" type="text" name="name" placeholder="Name" ></td>
  22.  
  23. <td><input id="in" type="text" name="type" placeholder="Type" ></td>
  24. <td><input id="in" type="text" name="company" placeholder="Company"></td>
  25. <td><input id="in" type="text" name="unit_price" placeholder="Price"></td>
  26. <td><input id="in" type="text" name="quantity" placeholder="Quantity"></td>
  27. <td><input id="in" type="text" name="total_amount" placeholder=""></td>
  28. <td><button type="button" id="add" name="add" >+</button></td>
  29. </tr>
  30. </table>
  31. <input id="submit" type="submit" name="insert" value="Submit" style="margin-left: 38%;">
  32.  
  33.  
  34. </form>
  35. </body>
  36. </html>
  37. <script type="text/javascript">
  38. var y=document.getElementById('cod').value;
  39. </script>
  40.  
  41. <?php
  42. $out=NULL;
  43. $servername="localhost";
  44. $username="root";
  45. $password="";
  46. $dbname="SMS";
  47. $conn = new mysqli($servername, $username, $password, $dbname);
  48. // Check connection
  49. if ($conn->connect_error) {
  50. die("Connection failed: " . $conn->connect_error);
  51. }
  52. else{
  53. $cod="<script>document.write(y);</script>";
  54.  
  55. echo $cod;
  56.  
  57.  
  58. $sql = "SELECT * FROM product WHERE pro_id='$cod' ";
  59. echo $sql;
  60. $result = $conn->query($sql);
  61.  
  62. if ($result->num_rows > 0) {
  63. // output data of each row
  64. while($row = $result->fetch_assoc()) {
  65.  
  66. $id=$row["pro_id"];
  67.  
  68.  
  69.  
  70. echo $row["pro_name"];
  71.  
  72.  
  73. }
  74. }else{
  75. echo "0 row";
  76. }
  77.  
  78. }
  79. ?> CODE#1 end
  80.  
  81. code#2 start
  82.  
  83. <!DOCTYPE html>
  84. <html>
  85. <head>
  86. <title></title>
  87. </head>
  88. <body>
  89. <form class="create_invoice" method="POST">
  90. <span id="c">#Code</span>
  91. <span id="n">Name</span>
  92. <span id="t">Type</span>
  93. <span id="co">Company</span>
  94. <span id="u">Unit price</span>
  95. <span id="q">Quantity</span>
  96. <span id="t">Total Price</span>
  97.  
  98. <table class="create_table" id="new_row">
  99. <tr>
  100. <td><input id="cod" class="code" type="text" name="code" value="f800"></td>
  101.  
  102. <td><input id="in" class="name" type="text" name="name" placeholder="Name" ></td>
  103.  
  104. <td><input id="in" type="text" name="type" placeholder="Type" ></td>
  105. <td><input id="in" type="text" name="company" placeholder="Company"></td>
  106. <td><input id="in" type="text" name="unit_price" placeholder="Price"></td>
  107. <td><input id="in" type="text" name="quantity" placeholder="Quantity"></td>
  108. <td><input id="in" type="text" name="total_amount" placeholder=""></td>
  109. <td><button type="button" id="add" name="add" >+</button></td>
  110. </tr>
  111. </table>
  112. <input id="submit" type="submit" name="insert" value="Submit" style="margin-left: 38%;">
  113.  
  114.  
  115. </form>
  116. </body>
  117. </html>
  118. <script type="text/javascript">
  119. var y=document.getElementById('cod').value;
  120. </script>
  121.  
  122. <?php
  123. $out=NULL;
  124. $servername="localhost";
  125. $username="root";
  126. $password="";
  127. $dbname="SMS";
  128. $conn = new mysqli($servername, $username, $password, $dbname);
  129. // Check connection
  130. if ($conn->connect_error) {
  131. die("Connection failed: " . $conn->connect_error);
  132. }
  133. else{
  134. $cod="f800";
  135.  
  136. echo $cod;
  137.  
  138.  
  139. $sql = "SELECT * FROM product WHERE pro_id='$cod' ";
  140. echo $sql;
  141. $result = $conn->query($sql);
  142.  
  143. if ($result->num_rows > 0) {
  144. // output data of each row
  145. while($row = $result->fetch_assoc()) {
  146.  
  147. $id=$row["pro_id"];
  148.  
  149.  
  150.  
  151. echo $row["pro_name"];
  152.  
  153.  
  154. }
  155. }else{
  156. echo "0 row";
  157. }
  158.  
  159. }
  160. ?>
  161.  
  162. code #2 end
  163.  
  164.  
  165.  
  166.  
  167. code#1 result
  168. f800SELECT * FROM product WHERE pro_id='f800' 0 row
  169. code#2 result
  170. f800SELECT * FROM product WHERE pro_id='f800' fresh up
Add Comment
Please, Sign In to add comment