okay I will show the code, I break up the code so it will return a result not to total things. It will not return 200 rows so I broke it up into east TX(90) and West TX(110). It returns the 90 east TX results, but the 110 West TX results it does not. I have to break it up into smaller sets to get a result.
// Define Wire Centers
// Company 400 Valor East
$wc1 = "ANNNTX";
$wc2 = "ATONTX";
$wc3 = "AVLNTX";
$wc4 = "AVRYTX";
$wc5 = "AVNGTX";
$wc6 = "BAWLTX";
$wc7 = "BLMRTX";
$wc8 = "BKVLTX";
$wc9 = "BEDSTX";
$wc10 = "BOGTTX";
$wc11 = "BNWRTX";
$wc12 = "BRDDTX";
$wc13 = "BRSNTX";
// Company 400 Valor West
$wc91 = "ABRNTX";
$wc92 = "ADRNTX";
$wc93 = "AMHRTX";
$wc94 = "ANDRTX";
$wc95 = "ANTNTX";
$wc96 = "ASPRTX";
$wc97 = "BARDTX";
$wc98 = "BNJMTX";
$wc99 = "BLWLTX";
$wc100 = "BLGVTX";
$stmt = OCIParse($connection, "select '$wc1' LOCATION, $query TOTAL from $wc1$table union
select '$wc2' LOCATION, $query TOTAL from $wc2$table union
select '$wc3' LOCATION, $query TOTAL from $wc3$table union
select '$wc4' LOCATION, $query TOTAL from $wc4$table union
select '$wc5' LOCATION, $query TOTAL from $wc5$table union
select '$wc6' LOCATION, $query TOTAL from $wc6$table union
select '$wc7' LOCATION, $query TOTAL from $wc7$table union
select '$wc8' LOCATION, $query TOTAL from $wc8$table union
select '$wc9' LOCATION, $query TOTAL from $wc9$table union
select '$wc10' LOCATION, $query TOTAL from $wc10$table union
select '$wc11' LOCATION, $query TOTAL from $wc11$table union
select '$wc12' LOCATION, $query TOTAL from $wc12$table union
select '$wc13' LOCATION, $query TOTAL from $wc13$table");
OCIExecute($stmt);
echo( date("l, F dS Y.") );
// Start of table and column headings (ID and Name)
print "<br><br>\n";
if ($table == ".cable where rb_state = 2")
echo ("<b>Total of All Copper Cable</b><br><br>");
if ($table == ".cable where type=32 and rb_state = 2")
echo ("<b>Total of Aerial Air Core Cable</b><br><br>");
if ($table == ".cable where type=30 and rb_state = 2")
echo ("<b>Total of Buried Air Core Cable</b><br><br>");
if ($table == ".cable where type=34 and rb_state = 2")
echo ("<b>Total of Underground Air Core Cable</b><br><br>");
if ($table == ".$table")
echo ("<b>Total of Aerial Copper Cable</b><br><br>");
if ($table == ".$table = 2 and frc=13")
echo ("<b>Total of Buried Copper Cable</b><br><br>");
if ($table == ".$table = 2 and frc=10")
echo ("<b>Total of Underground Copper Cable</b><br><br>");
if ($table == ".lg_cable where rb_state = 2")
echo ("<b>Total of All Lt. Guide Cable</b><br><br>");
if ($table == ".lg_cable where rb_state = 2 and frc=20")
echo ("<b>Total of Aerial Lt. Guide Cable</b><br><br>");
if ($table == ".lg_cable where rb_state = 2 and frc=25")
echo ("<b>Total of Buried Lt. Guide Cable</b><br><br>");
if ($table == ".lg_cable where rb_state = 2 and frc=23")
echo ("<b>Total of Underground Lt. Guide Cable</b><br><br>");
if ($table == ".conduit where rb_state = 2")
echo ("<b>Total of Trench Copper Conduit</b><br><br>");
if ($query == "sum(length*rb_size)")
echo ("<b>in Pair Miles</b><br><br>");
if ($query == "sum(length*no_fibers)")
echo ("<b>in Fiber Miles</b><br><br>");
print "<TABLE WIDTH=\"75%\" CELLSPACING=\"0\" CELLPADDING=\"1\" BORDER=\"1\">\n";
print " <TR><TH BGCOLOR=\"#BBBBBB\" WIDTH=\"40%\">Valor East Texas - Company 400</TH><TH BGCOLOR=\"#BBBBBB\"
WIDTH=\"20%\">In Feet</TH><TH BGCOLOR=\"#BBBBBB\" WIDTH=\"20%\">In Miles</TH><TH BGCOLOR=\"#BBBBBB\" WIDTH=\"20%\">In
Km</TH></TR>\n";
// Loop through results
while(OCIFetch($stmt))
{
print " <TD>" . OCIResult($stmt, "LOCATION") . "</TD>\n";
$feet = OCIResult($stmt, "TOTAL");
$number = number_format($feet);
print " <TD align=\"right\">" . $number . "</TD>\n";
$miles = round($feet / 5280, 2);
$number1 = number_format($miles, 2);
print " <TD align=\"right\">$number1</TD>\n";
$kilo = round($feet / 5280*1.609344, 2);
$number2 = number_format($kilo, 2);
print " <TD align=\"right\">$number2</TD>\n";
$tot_feet += $feet;
$number3 = number_format($tot_feet);
print " </TR>\n";
}
print "</TABLE>\n";
$tot_kilo = round($tot_feet / 5280*1.609344, 2);
$number4 = number_format($tot_kilo, 2);
print "<br>\n";
echo "<b>$number3 feet = $number4 km</b>";
print "<br><br>\n";
OCIFreeStatement($stmt);
$stmt = OCIParse($connection, "select '$wc91' LOCATION, $query TOTAL from $wc91$table union
select '$wc92' LOCATION, $query TOTAL from $wc92$table union
select '$wc93' LOCATION, $query TOTAL from $wc93$table union
select '$wc94' LOCATION, $query TOTAL from $wc94$table union
select '$wc95' LOCATION, $query TOTAL from $wc95$table union
select '$wc96' LOCATION, $query TOTAL from $wc96$table union
select '$wc97' LOCATION, $query TOTAL from $wc97$table union
select '$wc98' LOCATION, $query TOTAL from $wc98$table union
select '$wc99' LOCATION, $query TOTAL from $wc99$table union
select '$wc100' LOCATION, $query TOTAL from $wc100$table");
OCIExecute($stmt);
// Start of table and column headings (ID and Name)
print "<br><br>\n";
if ($table == ".cable where rb_state = 2")
echo ("<b>Total of All Copper Cable</b><br><br>");
if ($table == ".cable where type=32 and rb_state = 2")
echo ("<b>Total of Aerial Air Core Cable</b><br><br>");
if ($table == ".cable where type=30 and rb_state = 2")
echo ("<b>Total of Buried Air Core Cable</b><br><br>");
if ($table == ".cable where type=34 and rb_state = 2")
echo ("<b>Total of Underground Air Core Cable</b><br><br>");
if ($table == ".$table")
echo ("<b>Total of Aerial Copper Cable</b><br><br>");
if ($table == ".$table = 2 and frc=13")
echo ("<b>Total of Buried Copper Cable</b><br><br>");
if ($table == ".$table = 2 and frc=10")
echo ("<b>Total of Underground Copper Cable</b><br><br>");
if ($table == ".lg_cable where rb_state = 2")
echo ("<b>Total of All Lt. Guide Cable</b><br><br>");
if ($table == ".lg_cable where rb_state = 2 and frc=20")
echo ("<b>Total of Aerial Lt. Guide Cable</b><br><br>");
if ($table == ".lg_cable where rb_state = 2 and frc=25")
echo ("<b>Total of Buried Lt. Guide Cable</b><br><br>");
if ($table == ".lg_cable where rb_state = 2 and frc=23")
echo ("<b>Total of Underground Lt. Guide Cable</b><br><br>");
if ($table == ".conduit where rb_state = 2")
echo ("<b>Total of Trench Copper Conduit</b><br><br>");
if ($query == "sum(length*rb_size)")
echo ("<b>in Pair Miles</b><br><br>");
if ($query == "sum(length*no_fibers)")
echo ("<b>in Fiber Miles</b><br><br>");
print "<TABLE WIDTH=\"75%\" CELLSPACING=\"0\" CELLPADDING=\"1\" BORDER=\"1\">\n";
print " <TR><TH BGCOLOR=\"#BBBBBB\" WIDTH=\"40%\">Valor West Texas - Company 400</TH><TH BGCOLOR=\"#BBBBBB\"
WIDTH=\"20%\">In Feet</TH><TH BGCOLOR=\"#BBBBBB\" WIDTH=\"20%\">In Miles</TH><TH BGCOLOR=\"#BBBBBB\" WIDTH=\"20%\">In
Km</TH></TR>\n";
// Loop through results
while(OCIFetch($stmt))
{
print " <TD>" . OCIResult($stmt, "LOCATION") . "</TD>\n";
$feet = OCIResult($stmt, "TOTAL");
$number = number_format($feet);
print " <TD align=\"right\">" . $number . "</TD>\n";
$miles = round($feet / 5280, 2);
$number1 = number_format($miles, 2);
print " <TD align=\"right\">$number1</TD>\n";
$kilo = round($feet / 5280*1.609344, 2);
$number2 = number_format($kilo, 2);
print " <TD align=\"right\">$number2</TD>\n";
$tot_feet += $feet;
$number3 = number_format($tot_feet);
print " </TR>\n";
}
print "</TABLE>\n";
$tot_kilo = round($tot_feet / 5280*1.609344, 2);
$number4 = number_format($tot_kilo, 2);
print "<br>\n";
echo "<b>$number3 feet = $number4 km</b>";
print "<br><br>\n";
OCIFreeStatement($stmt);
?>