I am working on a time sentive project and keeping getting this error
Undefined variable: output
The way this script should work is if query gets results it fills in the form in the correct places and if not results are found display error message. I know it is something simple but i cant see it can any of you see what is causing $output to not be defined
Code is as Follows:
<?php
require_once('./includes/tickets.php'); //Connection File
include('./includes/config.inc.php'); // Error Handler
$query = "SELECT type, control, image, data FROM tickets
WHERE 'control'= GA-123456789 " ;
$result= mysql_query($query);
if( $result === FALSE ){
}else{
if( mysql_num_rows( $result ) > 0 ){ // results, do stuff!
$data = mysql_fetch_array( $result );
// what is displayed if everything is good
$output = <<< HTML
<table>
<tr>
<div align="center">
<table width="426" border="0">
<tr>
<td width="121" height="34"><div align="right">Type Of Ticket </div></td>
<td width="295"><div align="left">{$data['type']}</div></td>
</tr>
<tr>
<td height="39"><div align="right">Control Number </div></td>
<td><div align="left">{$data['control']}</div></td>
</tr>
<tr>
<td height="50"><div align="right">Ticket Is Valid</div></td>
<td><div align="left"><img src={$data['image']} alt="Ticket Status" name="image" width="100" height="100" id="image" /></div></td>
</tr>
<tr>
<td height="77"><div align="right">Ticket Data </div></td>
<td><div align="left">{$data['data']}</div></td>
</tr>
</table>
HTML
;
}else{
// no results, do something else
$output = "The Ticket Scanned Does Not Exist and was not sold by Slam-Pro.com.";
// there was an error! display error message
}
}
// when you print your page, just add "$output" at the appropriate spot in your HTML markup.
// if there are results, you'll see the <table>, if not, you'll see the "sorry" 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">Summer Heat Ticket Verify System<br />
</h1>
<p align="center"> </p>
<div align="center">
<?php print $output ?>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
</div>
</body>
</html>