我的 Sql 表
+------------+---------+
| name | price |
+------------+---------+
| A | 70 |
+------------+---------+
| B | 70 |
+------------+---------+
我用 TCPDF 创建了一个 pdf:
$pdo = $db->prepare("SELECT * FROM table");
$pdo->execute();
while ($row = $pdo->fetch(PDO::FETCH_ASSOC)) {
$result += $row['price'];
}
$html = '
<table><tr><th>'.$result.'</th></tr></table>'
;
我希望结果是140
,但我收到一条错误消息:
Notice: Undefined variable: result
TCPDF ERROR: Some data has already been output, can't send PDF file
注意:如果我删除+
标志。pdf 的创建没有错误,我得到了结果70
。