I have a very large database (658,000+ Records) and I have
to be able to search by zip code or state, and the results from
some of those variables need to be added and displayed.
The searching part I've got it done, but the adding, this is where I'm stuck.
Here is the code, hopefully somebody
could tell me what I'm doing wrong.
$Query = "SELECT zipcode, carrierrouteid, arescentral,
arescurb, aresndcbu, aresother,
aresfacility, arescontract, aresdetached,
aresnpu, prescentral, prescurb, presndcbu,
presother, presfacility, prescontract,
presdetached, presnpu
FROM $Table
WHERE stateabbrev='$stateabbrev'";
$Result = mysql_db_query ($DB, $Query, $Link);
//table
print ("<table border=1 cellspacing=2 cellpadding=2 align=center>\n");
print ("<tr align=center valign=top>\n");
print ("<td align=center valign=top>ZIP CODE</td>\n");
print ("<td align=center valign=top>Carrier Route</td>\n");
print ("<td align=center valign=top>Active</td>\n");
print ("<td align=center valign=top>Possible</td>\n");
print ("</tr>\n");
//fetch results
while ($Row = mysql_fetch_array
($Result)) {
print ("<tr align=center valign=top>\n");
print ("<td align=center valign=top>$Row[zipcode]</td>\n");
print ("<td align=center valign=top>$Row[carrierrouteid]</td>\n");
print ("<td align=center valign=top>sum($Row[arescentral], $Row[arescurb], $Row[aresndcbu],
$Row[aresother], $Row[aresfacility], $Row[arescontract], $Row[aresdetached],
$Row[aresnpu]</td>\n");
print ("<td align=center valign=top>sum($Row[prescentral], $Row[prescurb], $Row[presndcbu],
$Row[presother], $Row[presfacility], $Row[prescontract], $Row[presdetached],
$Row[presnpu]</td>\n");
print ("</tr>\n");
}
Here is the output that I get:
sum(0, 0, 0, 0, 0, 0, 0, 0 instead of 0
Thank you in advance