mwm
10-18-2007, 02:47 PM
I would like to know if I could do the 3 queries below in a single one. There has got to be a better way so the formating is across the screen and not down within the 3 tables. So I would think if 1 query could do the job then the formating would as well.
Thanks
<?
include "conn.php";
session_start();
$community=$_POST['community'];
$startdate=$_POST['startdate'];
$edate=$_POST['edate'];
?>
<html>
<body>
<title> Report</title>
<head>
</head>
<form action = "repprocess.php" method ="POST"></head>
<h1><p align=center>Report</p><p align=center> <?echo $community?></p></h1><h4><br>
Report Date <?echo $startdate?> - <?echo $edate?></h4>
<hr>
<?
$result =mysql_query ("SELECT customers.id, customers.community, csi.id, csi.contractor,count(contractor), csi.issuedate from customers,csi where customers.id = csi.id and csi.issuedate between '$startdate' and '$edate' and customers.community = '$community' group by csi.contractor");
echo "<table border=\"0\">";
echo "<th>Contractor</th>";
echo "<th>Issued</th>";
if (mysql_fetch_row($result) == 0)
{
echo "<center><font color = red>None!</font></center>";
}
else
{
$j = 0;
while ($row = mysql_fetch_array($result)) {
for ($i= 0; $i<mysql_fetch_row($row); $i ++) {
}
echo ($j++%2==0) ? '<tr bgcolor="#FFFFCC">' : '<tr bgcolor="#CCFF99">';
echo "<h4>";
echo "<td>" .($row[3]) . "</td>";
echo "<td>" .($row[4]) . "</td>";
}
echo '</table>';
echo "</center>";
}
?>
<?
$result1 =mysql_query ("SELECT customers.id, customers.community, csi.id, csi.contractor,count(contractor), csi.issuedate, csi.status='closed',count(status) from customers,csi where customers.id = csi.id and csi.issuedate between '$startdate' and '$edate' and customers.community = '$community' group by csi.contractor");
echo "<table border=\"0\">";
echo "<th>Contractor</th>";
echo "<th>Closed</th>";
if (mysql_fetch_row($result1) == 0)
{
echo "<center><font color = red>None!</font></center>";
}
else
{
$j = 0;
while ($row = mysql_fetch_array($result1)) {
for ($i= 0; $i<mysql_fetch_row($row); $i ++) {
}
echo ($j++%2==0) ? '<tr bgcolor="#FFFFCC">' : '<tr bgcolor="#CCFF99">';
echo "<h4>";
echo "<td>" .($row[3]) . "</td>";
echo "<td>" .($row[6]) . "</td>";
}
echo '</table>';
echo "</center>";
}
?>
<?
$result2 =mysql_query ("SELECT customers.id, customers.community, csi.id, csi.contractor, csi.status='open',count(status) from customers,csi where customers.id = csi.id and customers.community = '$community' AND status='open' group by csi.contractor");
echo "<table border=\"0\">";
echo "<th>Contractor</th>";
echo "<th>Open</th>";
if (mysql_fetch_row($result2) == 0)
{
echo "<center><font color = red>None!</font></center>";
}
else
{
$j = 0;
while ($row = mysql_fetch_array($result2)) {
for ($i= 0; $i<mysql_fetch_row($row); $i ++) {
}
echo ($j++%2==0) ? '<tr bgcolor="#FFFFCC">' : '<tr bgcolor="#CCFF99">';
echo "<h4>";
echo "<td>" .($row[3]) . "</td>";
echo "<td>" .($row[5]) . "</td>";
}
echo '</table>';
echo "</center>";
}
?>
<br>
<br>
<input type="button" value="MAIN" style="font-size:15" onClick="parent.location='managerstart.php'">
</form>
</body>
</html>
Thanks
<?
include "conn.php";
session_start();
$community=$_POST['community'];
$startdate=$_POST['startdate'];
$edate=$_POST['edate'];
?>
<html>
<body>
<title> Report</title>
<head>
</head>
<form action = "repprocess.php" method ="POST"></head>
<h1><p align=center>Report</p><p align=center> <?echo $community?></p></h1><h4><br>
Report Date <?echo $startdate?> - <?echo $edate?></h4>
<hr>
<?
$result =mysql_query ("SELECT customers.id, customers.community, csi.id, csi.contractor,count(contractor), csi.issuedate from customers,csi where customers.id = csi.id and csi.issuedate between '$startdate' and '$edate' and customers.community = '$community' group by csi.contractor");
echo "<table border=\"0\">";
echo "<th>Contractor</th>";
echo "<th>Issued</th>";
if (mysql_fetch_row($result) == 0)
{
echo "<center><font color = red>None!</font></center>";
}
else
{
$j = 0;
while ($row = mysql_fetch_array($result)) {
for ($i= 0; $i<mysql_fetch_row($row); $i ++) {
}
echo ($j++%2==0) ? '<tr bgcolor="#FFFFCC">' : '<tr bgcolor="#CCFF99">';
echo "<h4>";
echo "<td>" .($row[3]) . "</td>";
echo "<td>" .($row[4]) . "</td>";
}
echo '</table>';
echo "</center>";
}
?>
<?
$result1 =mysql_query ("SELECT customers.id, customers.community, csi.id, csi.contractor,count(contractor), csi.issuedate, csi.status='closed',count(status) from customers,csi where customers.id = csi.id and csi.issuedate between '$startdate' and '$edate' and customers.community = '$community' group by csi.contractor");
echo "<table border=\"0\">";
echo "<th>Contractor</th>";
echo "<th>Closed</th>";
if (mysql_fetch_row($result1) == 0)
{
echo "<center><font color = red>None!</font></center>";
}
else
{
$j = 0;
while ($row = mysql_fetch_array($result1)) {
for ($i= 0; $i<mysql_fetch_row($row); $i ++) {
}
echo ($j++%2==0) ? '<tr bgcolor="#FFFFCC">' : '<tr bgcolor="#CCFF99">';
echo "<h4>";
echo "<td>" .($row[3]) . "</td>";
echo "<td>" .($row[6]) . "</td>";
}
echo '</table>';
echo "</center>";
}
?>
<?
$result2 =mysql_query ("SELECT customers.id, customers.community, csi.id, csi.contractor, csi.status='open',count(status) from customers,csi where customers.id = csi.id and customers.community = '$community' AND status='open' group by csi.contractor");
echo "<table border=\"0\">";
echo "<th>Contractor</th>";
echo "<th>Open</th>";
if (mysql_fetch_row($result2) == 0)
{
echo "<center><font color = red>None!</font></center>";
}
else
{
$j = 0;
while ($row = mysql_fetch_array($result2)) {
for ($i= 0; $i<mysql_fetch_row($row); $i ++) {
}
echo ($j++%2==0) ? '<tr bgcolor="#FFFFCC">' : '<tr bgcolor="#CCFF99">';
echo "<h4>";
echo "<td>" .($row[3]) . "</td>";
echo "<td>" .($row[5]) . "</td>";
}
echo '</table>';
echo "</center>";
}
?>
<br>
<br>
<input type="button" value="MAIN" style="font-size:15" onClick="parent.location='managerstart.php'">
</form>
</body>
</html>