I need to manipulate the results of two queries and put them in a table. The table has two columns, VSC# and VSC %.
VSC # = $result1 - $result2
VSC % = $result 2 / $result 1
I know that I need to put the math functions in the "foreach" statement, but I'm not getting the syntax right, and I keep getting a big, fat nothing where numbers should be in my table. I've been trying and trying to get this right, but no luck. Somebody PLEASE take me by my little newbie hand and show me the code....
Here is the code I am using for the table, which right now just displays the results of query2, rather than the math results I need.
print "<table summary= vsc>";
//print field names
print "<tr>\n";
print "<th bgcolor=ffffff># VSC </th>\n";
print "<th bgcolor=ffffff>% VSC </th>\n";
print "</tr>\n";
//get row data as an associative array
while ($row = mysql_fetch_assoc($result2)){
//look at each field
foreach ($row as $col=>$val2){
print "<tr>\n";
print " <td bgcolor=cccccc align=center>$val2</td>\n";
print "</tr>\n";
}//end foreach
}//end while
print "</table>\n";