Location: PHPKode > projects > PAT and Inventory Management System > m/a/checkin.php
<!--
	Pat and Inventory Management System
	Version 0.1
	Created by Tom Dyer
	Last edited by Tom Dyer 20/9/09
	Quick Checkin
-->
<html>

    <form action="" method="get" name="input">
    <input type="text" name = "ref"></input>
    </form> 
</html>
	
<?php
session_start();	// This connects to the existing session. Allows sharing of variables between pages for a smoother user experience
$directory = $_SESSION['docroot'];
include_once '../../config.php';

	$ref = $_GET['ref'];
	mysql_connect($sqlhost,$username,$password);						//connect to the database
	@mysql_select_db($database) or die( 'Sorry, Session Timed out. <a href="../">Start Again</a>');
	
	$gsearch = mysql_query("SELECT * FROM gigs WHERE ref='$ref'");	//Check if item is on a Gig
	while($grow = mysql_fetch_array($gsearch))	//Start While Loop
	{
		$aref=$grow['ref'];	//Set variables from database record
		$bgig=$grow['gig'];
		$bqantity=$grow['quantity'];
		$bback=$grow['back'];
	}	//Close Gig check
			
	$back = $bback + 1;
	
	mysql_query("UPDATE gigs SET back = '$back' WHERE ref = '$ref'");
	//echo "<br /> Done";
	mysql_close();
	Header("Location: index.php");
?>
Return current item: PAT and Inventory Management System