我的代码:
$gettotz=0;
while($mycartqry=mysqli_fetch_array($cartqry)){
$one=$mycartqry['nos'];
$two=$gettotz;
echo $gettotz.=$myVar+$myVar2;
}
db viz 10和12中有两个值。我的答案是01012.我的答案应该是22 ...帮助请
答案 0 :(得分:0)
应该是这样的:
$gettotz=0;
while ($mycartqry=mysqli_fetch_array($cartqry)){
$one = $mycartqry['nos'];
$gettotz += $one;
// what is `$myVar` and `$myVar2` is unclear
// but if they exists you can also add'em:
// $gettotz += $one + $myVar + $myVar2;
}
echo $gettotz;