Location: PHPKode > projects > Tech Tickets > my_tickets_viewall.php
<?php
$sess = session_start();
$p_id = $_SESSION['pid'];
?>
<?php require_once('include/connections.php'); ?>
<?php
mysql_select_db($database, $conn);
$query_ticket_list = "SELECT tt_id, parent_tt_id, cl_id, p_id, date_format(datetimestamp,'%m-%d-%Y %r') as datetimestamp, status, urgency, subject FROM tt_tickets WHERE parent_tt_id = 0 AND p_id = $p_id ORDER BY tt_id DESC";
$ticket_list = mysql_query($query_ticket_list, $conn) or die(mysql_error());
$row_ticket_list = mysql_fetch_assoc($ticket_list);
$totalRows_ticket_list = mysql_num_rows($ticket_list);
?>
<?php include("welcome.php"); ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
	<title>Tech Tickets</title>
	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
	<link href="include/style.css" type="text/css" rel="stylesheet" />
</head>

<body topmargin="0">
<?php include("header.php"); ?>
      <h1 align="center"><font face="Verdana, Arial, Helvetica, sans-serif">View My Tickets</font></h1>
      <br>
      <?php
	  if($totalRows_ticket_list>0) {	#if any tickets to display
	  
	  ?>
      <table border="0" cellpadding="2" cellspacing="2" align="center" width="90%">
        <tr bgcolor="#666666"> 
          <td><strong><font color="#FFFFFF" size="2" face="Verdana, Arial, Helvetica, sans-serif">Submitted</font></strong></td>
          <td><strong><font color="#FFFFFF" size="2" face="Verdana, Arial, Helvetica, sans-serif">Subject</font></strong></td>
          <td><strong><font color="#FFFFFF" size="2" face="Verdana, Arial, Helvetica, sans-serif">Status</font></strong></td>
          <td><font color="#FFFFFF" size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>Urgency</strong></font></td>
          <td><strong><font color="#FFFFFF" size="2" face="Verdana, Arial, Helvetica, sans-serif">Num 
            </font></strong></td>
        </tr>
        <?php do { ?>
        <tr bgcolor="#CCCCCC"> 
          <td><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><?php echo $row_ticket_list['datetimestamp']; ?></font></td>
          <td><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><a href="my_tickets_viewone.php?tt_id=<?php echo $row_ticket_list['tt_id']; ?>"><?php echo $row_ticket_list['subject']; ?></a></font></td>
          <td> 
            <?php if ($row_ticket_list['status']=="O" || $row_ticket_list['status']=="E") {$status="Open";} elseif($row_ticket_list['status']=="C") {$status="Closed";} elseif($row_ticket_list['status']=="P") {$status="Pending";}?>
            <font size="2" face="Verdana, Arial, Helvetica, sans-serif" color="<?php if ($status=='Open') {echo '#009900';} else {echo '#000000';}?>"> 
            <?php echo $status; ?> </font> </td>
          <td> 
            <?php 
		  $theurgency = $row_ticket_list['urgency'];
		  if ($theurgency=='E') {$urgency='Emergency';} elseif ($theurgency=='A') {$urgency='ASAP';} else {$urgency='Next Visit';}?>
            <font size="2" face="Verdana, Arial, Helvetica, sans-serif" color="<?php if ($urgency=='Emergency') {echo '#993300';} elseif ($urgency=='ASAP') {echo '#cc6600';} else {echo '#000000';}?>"> 
            <?php echo $urgency; ?> </font></td>
          <td><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><?php echo $row_ticket_list['tt_id']; ?></font></td>
        </tr>
        <?php } while ($row_ticket_list = mysql_fetch_assoc($ticket_list)); ?>
      </table>
	  <?php
	  } else {
	  #else, no tickets exist 
	  echo "<p align='center'>No Tickets</p>";
	  }
	  ?>
	  
<p>&nbsp;</p>
<?php include("footer.php"); ?>  
</body>
</html>
<?php
mysql_free_result($ticket_list);
?>
Return current item: Tech Tickets