Location: PHPKode > projects > Helpdesk Over Web > how/reports/myreport-today.php
<?php

// Reporting - Daily Summary

// Include Configuration File
require_once ('../includes/config.inc'); 

// Set the page title and include the HTML header.
$page_title = 'Helpdesk Over Web - Reports - My Daily Performance';
include ('../includes/header.html');

// Connect to Database
require_once ('../includes/mysql_connect.php');

$datetoday = date("d.m.y");
$dateforsql = date("Y-m-d");
$engineer = $_SESSION['LoggedInUser'];

// Output query results in a table.
echo ("<H1>Report Functions</H1>");
echo ("<H2>Daily Summary - $datetoday</H2>");
echo ("<H3>Engineer : $engineer</H3>");
$query = "SELECT * FROM calls WHERE Date='$dateforsql' AND Engineer = '$engineer';";		
$result = mysql_query($query)
   or die("Invalid query: " . mysql_error());
$num_rows = mysql_num_rows($result);
echo ("<H4><B>Total Calls Today: </B> $num_rows</H4>");

// Retrieves list of status categories from database.
$sql = "SELECT * FROM statcategories ORDER BY StatusText;";
$statlist = mysql_query($sql)
   or die("Invalid query: " . mysql_error());
while($i = mysql_fetch_row($statlist)) 
	{ 
	$statuslist[$j] = $i[1];
	$j++;
	}
	
// Calculates how many status categories are to be displayed.
$totalcategories = count($statuslist);

// Outputs each status category and its number of calls.
echo "<UL>";
while($x < $totalcategories)
 	{
 	$currentstatus = $statuslist[$x];
 	$query = "SELECT * FROM calls WHERE Date='$dateforsql' AND callstatus LIKE '$currentstatus' AND engineer = '$engineer';";		
 	$result = mysql_query($query)
 	   or die("Invalid query: " . mysql_error());
  	$num_rows = mysql_num_rows($result);
 	echo ("<P><B>$currentstatus: </B> $num_rows</P>");
	$x++;
 	}
echo "</UL>";
echo "<P>[ <A HREF='reports.php'>Reports Menu</A> ]</P>";
// Include standard HTML footer
include ('../includes/footer.html');
?>
Return current item: Helpdesk Over Web