Undifine variable notice help. Doesn't look to pretty on the screen

$result = mysql_query("SELECT * FROM cart INNER JOIN kb ON cart.id = kb.id WHERE cart.cookieId = '" . GetCartId() . "' ORDER BY kb.name ASC");?>

<?php while($row = mysql_fetch_array($result))
{
// Increment the total cost of all items
$totalCost += ($row["qty"] * $row["price"]); line 207
?>

<b>Notice</b>: Undefined variable: totalCost in <b>C:\wamp\www\store\cart.php</b> on line <b>207</b><br />

The price is coming from kb table and qty is coming form cart. I don’t know why it is throwing this undefine variable notice. to my knowledge I think the variable is defined as it is. Please any body has any comments on why it is throwing this notice?

Thank you

The reason you get an undefined var notice is pretty simply because you are trying to use undefined variables
<?php
$totalCost = 0; // now it is defined you can do stuff like += with it
while($row = mysql_fetch_array($result))
{
// Increment the total cost of all items
$totalCost += ($row[“qty”] * $row[“price”]); line 207
?>

Thank you Hash!