hello everyone
Working on a bit of a odd project and am wanting to add a function to my script.
Now this project is a ticket verify system for a upcoming event. All tickets that are sold online have a QR code on the ticket that is scan by event staff to verify the ticket. Each QR code is linked to local system that then checks the control number. ( No Internet access)
What i am trying to add is to set a function that allows a single result to be displayed once
ex: ticket is scanned with a control number of 123456789. when that ticket is scanned i want to update the database to mark that ticket as already being scan so if that same control number is scanned again it becomes invalid .
Problem is that i am not sure were to begin to modify this script to do this.
scan in query is database field that will store scan count and has a value of 0 mif there is no count and a 1 if that control number has been scanned already
here is the script
Can Someone help me figure out where to begin
require_once('./includes/tickets.php'); //connection file
$query = "SELECT type, control, image, scan, data FROM tickets WHERE control = 'R5-594215548' ";
$result = mysql_query($query);
if ($result === FALSE) {
} else {
if (mysql_num_rows($result) > 0) { // results
$data = mysql_fetch_array($result);
if ($data['scan'] == 1) {
echo "<h1> The Ticket Scanned Has Already Been Scanned. This is a invalid ticket.</h1>";
}
// what is displayed if everything is good
$output = <<< HTML
<table>
<tr>
<div align="center">
<table width="413" border="0">
<tr>
<td width="160" height="52"><div align="left">
<h2>Type Of Ticket </h2>
</div></td>
<td width="243"><div align="left">
<h2>{$data['type']}</h2>
</div></td>
</tr>
<tr>
<td height="70"><div align="left">
<h2>Control Number </h2>
</div></td>
<td><div align="left">
<h2>{$data['control']}</h2>
</div></td>
</tr>
<tr>
<td height="50"><div align="left">
<h2>Ticket Validation</h2>
</div></td>
<td><div align="left">
<h2><img src={$data['image']} alt="Ticket Status" name="image" width="71" height="67" id="image" /></h2>
</div></td>
</tr>
<tr>
<td height="77"><div align="left">
<h2>Ticket Data </h2>
</div></td>
<td><div align="left">
<h2>{$data['data']}</h2>
</div></td>
</tr>
</table>
HTML
;
} else {
// no results
$output = "<h1> The Ticket Scanned Does Not Exist and was not sold by #######.com.</h1>";
// there was an error! display error message
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Ticket Look Up Results</title>
</head>
<body>
<h1 align="center">Ticket Verify System<br />
</h1>
<p align="center"> </p>
<div align="center">
<?php
print $output;