$forData = "SELECT item, GROUP_CONCAT(? ORDER BY ?) AS chartData
FROM old_record_sales
WHERE (item = ? OR ? IS NULL)
GROUP BY item";
$stmt = $dbcon->prepare($forData);
$params = [
$type,
$sort,
$flwr,
$flwr
];
$stmt->execute($params);
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
extract($row);
$data[] = $row['chartData'];
$dataNames[] = $row['item'];
}
每当我回显$data[]
的值时,它都会显示列名,而不是我指定的列中的值。如何获得$data[] = $row['chartData'];
将该列的值插入$data
中?
如果我这样写就可以了:
GROUP_CONCAT($type ORDER BY ?)
预先感谢您的帮助。