Undefined variables - totals

this code below works but I get the below messages. what must I change to not get the messages?

<?php
mysql_connect("localhost","root","");
mysql_select_db('oodb') or die( "Unable to select database");
$query=" SELECT * FROM oocust WHERE payrec = 'P'AND pd = ' '";
$result=mysql_query($query);
$num=mysql_numrows($result);
echo date("m/d/Y") . "<br />";
echo "<font size=+2><b> Old Orchard Plumbing A/P Due Report</font></b></b><br />";
echo "<table cellspacing=1 cellpadding=0 border=0>
<tr>
<th colspan=2></th>
<th align=left>order</th>
<th>days</th>
<th>ship</th>
<th></th>
<tr>
<th>Inv#</th>
<th>Customer</th>
<th align=left>date</th>
<th>late</th>
<th>amt</th>
<th align=right>Charges</th>
<th align=right>tax</th>
<th align=right>Owed</th>
<tr>
<TH colspan=9>=======================================================================</TH>
</tr>";
while($row = mysql_fetch_array($result))
{
$totcharges = $totcharges + $row['charges'];
$tottax = $tottax + $row['tax'];
$totamtdue = $totamtdue + $row['amtdue'];
$totship = $totship + $row['shipamt'];
echo "<tr>";
echo "<td>" . $row['invnum'] . "</td>";
echo "<td>" . $row['bname'] . "</td>";
echo "<td>" . $row['dateord'] . "</td>";
echo "<td align=right>" . $row['dayslate'] . "</td>";
echo "<td align=right>" . $row['shipamt'] . "</td>";
echo "<td align=right>" . $row['charges'] . "</td>";
echo "<td align=right>" . $row['tax'] . "</td>";
echo "<td align=right>" . $row['amtdue'] . "</td>";
}
echo "<tr>";
echo "<th colspan=9>=======================================================================</TH>";
echo "<tr>";
echo "<td>Gtotals</td>";
echo "<td></td>";
echo "<td></td>";
echo "<td></td>";
echo "<td align=right>" . sprintf("%.2f",$totship) .
"</td>";
echo "<td align=right>" . sprintf("%.2f",$totcharges) .
"</td>";
echo "<td align=right>" . sprintf("%.2f",$tottax) .
"</td>";
echo "<td align=right>" . sprintf("%.2f",$totamtdue) .
"</td>";
echo "</tr>";
echo "</table>";
mysql_close();
?> 

08/13/2011

Old Orchard Plumbing A/P Due Report
order days ship
Inv# Customer date late amt Charges tax Owed
=======================================================================

Notice: Undefined variable: totcharges in C:\xampp\htdocs\invoice\apdue.php on line 30

Notice: Undefined variable: tottax in C:\xampp\htdocs\invoice\apdue.php on line 31

Notice: Undefined variable: totamtdue in C:\xampp\htdocs\invoice\apdue.php on line 32

Notice: Undefined variable: totship in C:\xampp\htdocs\invoice\apdue.php on line 33
154 kennys machine shop 10/15/2010 270 0.00 5.35 0.31 5.66

Gtotals 0.00 5.35 0.31 5.66

During the first loop…
$totcharges = $totcharges + $row[‘charges’];
$totcharges has no value yet, so $totcharges = <nothing> + rowvalue throws the error.
Initialize your variables before the while begins.