I'm having trouble properly calculating and outputting the variable $total_member_points. What is happening right now is that it takes the value ($points_car1) in the last row of the array and adds it to each value of $points_car2. How can I add the same rows of $points_car1 and $points_car2?
$connection = mysql_connect($dbhost, $dbuser, $dbpass)
or die ("Not Able to connect");
$db = mysql_select_db($dbname, $connection)
or die ("Not Able to connect");
$query = "SELECT Drivers.Points
FROM Drivers, Members
WHERE (Members.Car1 =Drivers.CarNumber)";
$result = mysql_query($query)
or die ("Not Able to connect");
while ($row = mysql_fetch_array($result, MYSQL_NUM))
{
$points_car1 = $row[0];
echo "<table cellspacing=0 border=0>\n";
echo "<tr>\n
<td> $points_car1</td>\n
</tr>";
}
echo "</table>\n";
$query = "SELECT Drivers.Points
FROM Drivers, Members
WHERE (Members.Car2 =Drivers.CarNumber)";
$result = mysql_query($query)
or die ("Not Able to connect");
while ($row = mysql_fetch_array($result, MYSQL_NUM))
{
$points_car2 = $row[0];
$total_member_points= $points_car1 + $points_car2;
echo "<table cellspacing=0 border=0>\n";
echo "<tr>\n
<td width=100></td>\n
<td width=50>$total_member_points</td>\n
</tr>\n";
}
echo "</table>\n";
?>
</body>
</html>