Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <title>Coro Catalog Inventory
- </title>
- </head>
- <body>
- <?php
- $username='root';
- $password='thisisatest';
- $database='corocatalog';
- $monkeys=mysql_connect(localhost,$username,$password) or die("Unable to select database : " . mysql_error());
- @mysql_select_db($database);
- ?>
- <h1>General Inventory</h1>
- <?
- $query = "SELECT item FROM lastin";
- $theresult = mysql_query($query);
- $selectthis=mysql_result($theresult,0,"item");
- $query = "SELECT * FROM equip";
- $newresult = mysql_query($query);
- $num=mysql_numrows($newresult);
- ?>
- <form action="<?php echo $PHP_SELF ?>" method="post">
- Item: <select name="item">
- <?
- $j=0;
- while ( $j < $num ) {
- $field1=mysql_result($newresult,$j,"ident");
- $field2=mysql_result($newresult,$j,"Name");
- if ( $field1 != $selectthis ) {
- ?>
- <option value=<? echo $field1; ?>><? echo $field2; ?></option>
- <?
- }
- else {
- ?>
- <option selected value=<? echo $field1; ?>><? echo $field2; ?></option>
- <?
- }
- $j++;
- }
- ?>
- </select>
- Shipment: <input type="text" name="shipment"> 
- S/N: <input type="text" name="serial"> 
- Detail: <input type="text" name="detail"> 
- <input type="Submit">
- </form>
- <?
- $item=$_POST['item'];
- $shipment=$_POST['shipment'];
- $serial=$_POST['serial'];
- $detail=$_POST['detail'];
- if ( $serial ) {
- $checkdigit=mysql_query('SELECT * FROM general WHERE serial = "' . $serial . '"');
- $exists=mysql_numrows($checkdigit);
- if ( !$exists ) {
- $result=mysql_query('SELECT ident FROM ident');
- $ident=mysql_result($result,0);
- $status='checkin';
- $query='UPDATE lastin SET item="' . $item . '"';
- mysql_query($query);
- $query = "INSERT INTO general VALUES ('$ident','$item','$shipment','$serial','$status','$detail')";
- mysql_query($query);
- $ident=$ident+1;
- $query = "UPDATE ident SET ident='$ident'";
- $doit=mysql_query($query);
- }
- else {
- echo "<b>!--Serial number already in general inventory--!</b>";
- }
- }
- $query = 'SELECT * FROM general';
- $result = mysql_query($query);
- $num=mysql_numrows($result);
- mysql_close();
- ?>
- <table border="1" cellspacing="2" cellpadding="1">
- <tr>
- <th>Item</th>
- <th>Shipment</th>
- <th>S/N</th>
- <th>Status</th>
- <th>Detail</th>
- <th>Piece ID</th>
- </tr>
- <?
- $i=0;
- while ( $i < $num ) {
- $field1=mysql_result($result,$i,"item");
- $field2=mysql_result($result,$i,"shipment");
- $field3=mysql_result($result,$i,"serial");
- $field4=mysql_result($result,$i,"status");
- $field5=mysql_result($result,$i,"detail");
- $field6=mysql_result($result,$i,"id");
- ?>
- <tr>
- <td><?php echo $field1; ?></td>
- <td><?php echo $field2; ?></td>
- <td><?php echo $field3; ?></td>
- <td><?php echo $field4; ?></td>
- <td><?php echo $field5; ?></td>
- <td><?php echo $field6; ?></td>
- </tr>
- <?
- $i++;
- }
- ?>
- </table>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement