Advertisement
Guest User

Untitled

a guest
Jul 5th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.00 KB | None | 0 0
  1. <html>
  2. <head>
  3. <title>Coro Catalog Inventory
  4. </title>
  5. </head>
  6.  
  7. <body>
  8.  
  9. <?php
  10.  
  11. $username='root';
  12. $password='thisisatest';
  13. $database='corocatalog';
  14.  
  15. $monkeys=mysql_connect(localhost,$username,$password) or die("Unable to select database : " . mysql_error());
  16.  
  17. @mysql_select_db($database);
  18.  
  19. ?>
  20. <h1>General Inventory</h1>
  21.  
  22. <?
  23. $query = "SELECT item FROM lastin";
  24. $theresult = mysql_query($query);
  25. $selectthis=mysql_result($theresult,0,"item");
  26.  
  27. $query = "SELECT * FROM equip";
  28. $newresult = mysql_query($query);
  29. $num=mysql_numrows($newresult);
  30. ?>
  31.  
  32. <form action="<?php echo $PHP_SELF ?>" method="post">
  33. Item: <select name="item">
  34. <?
  35. $j=0;
  36. while ( $j < $num ) {
  37. $field1=mysql_result($newresult,$j,"ident");
  38. $field2=mysql_result($newresult,$j,"Name");
  39.  
  40. if ( $field1 != $selectthis ) {
  41. ?>
  42. <option value=<? echo $field1; ?>><? echo $field2; ?></option>
  43. <?
  44. }
  45.  
  46. else {
  47. ?>
  48. <option selected value=<? echo $field1; ?>><? echo $field2; ?></option>
  49. <?
  50. }
  51. $j++;
  52. }
  53. ?>
  54. </select>
  55. Shipment: <input type="text" name="shipment">&nbsp
  56. S/N: <input type="text" name="serial">&nbsp
  57. Detail: <input type="text" name="detail">&nbsp
  58. <input type="Submit">
  59. </form>
  60.  
  61. <?
  62. $item=$_POST['item'];
  63. $shipment=$_POST['shipment'];
  64. $serial=$_POST['serial'];
  65. $detail=$_POST['detail'];
  66.  
  67. if ( $serial ) {
  68.  
  69. $checkdigit=mysql_query('SELECT * FROM general WHERE serial = "' . $serial . '"');
  70. $exists=mysql_numrows($checkdigit);
  71.  
  72. if ( !$exists ) {
  73.  
  74. $result=mysql_query('SELECT ident FROM ident');
  75. $ident=mysql_result($result,0);
  76.  
  77. $status='checkin';
  78.  
  79. $query='UPDATE lastin SET item="' . $item . '"';
  80. mysql_query($query);
  81.  
  82. $query = "INSERT INTO general VALUES ('$ident','$item','$shipment','$serial','$status','$detail')";
  83. mysql_query($query);
  84.  
  85. $ident=$ident+1;
  86. $query = "UPDATE ident SET ident='$ident'";
  87.  
  88. $doit=mysql_query($query);
  89. }
  90.  
  91. else {
  92. echo "<b>!--Serial number already in general inventory--!</b>";
  93. }
  94. }
  95.  
  96. $query = 'SELECT * FROM general';
  97. $result = mysql_query($query);
  98.  
  99. $num=mysql_numrows($result);
  100.  
  101. mysql_close();
  102. ?>
  103. <table border="1" cellspacing="2" cellpadding="1">
  104. <tr>
  105. <th>Item</th>
  106. <th>Shipment</th>
  107. <th>S/N</th>
  108. <th>Status</th>
  109. <th>Detail</th>
  110. <th>Piece ID</th>
  111. </tr>
  112. <?
  113. $i=0;
  114. while ( $i < $num ) {
  115. $field1=mysql_result($result,$i,"item");
  116. $field2=mysql_result($result,$i,"shipment");
  117. $field3=mysql_result($result,$i,"serial");
  118. $field4=mysql_result($result,$i,"status");
  119. $field5=mysql_result($result,$i,"detail");
  120. $field6=mysql_result($result,$i,"id");
  121. ?>
  122.  
  123. <tr>
  124. <td><?php echo $field1; ?></td>
  125. <td><?php echo $field2; ?></td>
  126. <td><?php echo $field3; ?></td>
  127. <td><?php echo $field4; ?></td>
  128. <td><?php echo $field5; ?></td>
  129. <td><?php echo $field6; ?></td>
  130. </tr>
  131.  
  132. <?
  133. $i++;
  134. }
  135. ?>
  136. </table>
  137.  
  138. </body>
  139. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement