Here's what I have as a foundation.
Code: Select all
<?php
$conn = mysql_connect("localhost", "root", "") or die(mysql_error());
mysql_select_db('phpcollab25beta', $conn) or die(mysql_error());
echo "<body link="#666666" vlink="#000000" alink="#000000">";
if (empty($id)){ // Checks the url to see if there is a value for $id.
// If not, is lists all entries in the database under that table.
$opened = 0;
$closed = 0;
$stat1 = 1;
// Status Test 2
$statresult1 = mysql_query("SELECT status FROM phpcollabsdesk_fc WHERE status = '" . $stat1 . "'");
$opened = mysql_num_rows($statresult1);
printf (" Open Requests: <b>%s</b> - ", $opened);
$stat2 = 0;
$statresult2 = mysql_query("SELECT status FROM phpcollabsdesk_fc WHERE status = '" . $stat2 . "'");
$closed = mysql_num_rows($statresult2);
printf ("Closed Requests: <b>%s</b>.", $closed);
$logstotal = $opened + $closed;
printf (" Total Logs: <b>%s</b>", $logstotal);
echo ( "<table cellpadding="1" bgcolor="#ffffff" width="100%"><tr><td>");
// This is the start of the table I refer to in my opening paragraph
echo ( "<table cellpadding="1" cellspacing="1" bgcolor="#99CCEE" width="100%"><tr bgcolor="#1E90FF" align="center"><td><b>Requested By</b></td><td><b>Issue</b></td><td><b>Request</b></td><td><b>Priority</b></td><td><b>Location</b><td><b>Status</b></td><td><font size='4'> </tr>");
$result = mysql_query("SELECT * FROM phpcollabsdesk_fc");
$myrow = mysql_fetch_array($result);
$i = 0; // sets up the counter for coloring the table rows.
do{
if($i % 2 == 0) //checks to see if the line is an even number
{
printf ("<tr valign="center" bgcolor="#EEF7ff"><td><!--<a href="newtest.php?id=%s">-->", $myrow["id"]);
}else{
// The whole purpose of this second area is to just change the highlighting of the table
printf ("<tr valign="center" bgcolor="#DBEDff"><td><!--<a href="newtest.php?id=%s">-->", $myrow["id"]);
}
printf ( "%s</a>",$myrow["Requested_By"]);
printf ( "<td>%s", $myrow["Issue"]);
printf ( "<td>%s", $myrow["Request"]);
printf ( "<td><center>%s", $myrow["Priority"]);
printf ( "<td><center>%s", $myrow["Location"]);
if($myrow["status"] == 1){ // This "if" statement checks to see if the status of the request is opened or closed.
$status = "Open";
}
else{
$status = "Closed";
}
printf ( "<td><center>%s", $status);
echo "<td><valign='center'><font size="4"> </font>";
$i++;
}while ($myrow = mysql_fetch_array($result));
echo "</table>";
}
?>