Hi,
I am having a problem with undefined variable. But I am actually not sure what is the problem is.
<?php
require_once "dbconnect.php";
$link=dbconnect();
$query=("select *from cart where cid='$cid'");
$result=mysql_query($query);
$count2=mysql_num_rows($result);
while($row= mysql_fetch_array($result))
{
$count=1;
[COLOR="Red"]$totalprice+=$row['copies']*$row['price'];[/COLOR]
$count+=1;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Welcome to Your Store </title>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<div class="borderbox">
<div class="leftcol_box">
<div id="product_search">
<h2><span>Your Shopping Cart </span></h2>
<div class="content">
</br>
<center>
<p align="left"><?php Echo $name;?> </p>
<br>
<p align="left">Total Products : <?php Echo $count2;?> </p>
<p align="left">Total Amount : <?php Echo $totalprice;?></p>
<br>
<a href="vnc.php">View and Checkout
</a>
</center>
</div>
</div>
</div>
</div>
this code giving me the output but also giving me a notice --
Notice: Undefined variable: totalprice in C:\wamp\www\Your Store\cart.php on line 13
I am not sure how to fix it. Anyone can help me pls?