我有这个并且一切正常(我有一个通用的表构建器,但现在我不得不偏离它):
while ($x = mysqli_fetch_assoc($result))
{
$fields[] = $x['Field'];
}
现在我有类似的东西:
$result = mysqli_query($con, 'SELECT r.id AS ID, CONCAT(g.fname, g.lname) AS Name, r.apple AS Apple,
r.dog AS Dog, DATEDIFF(r.Dog, r.Apple) AS Days,
r.total_price AS "Total Price", u.name AS Name, r.in AS "In",
r.out AS "Out", r.time_in AS "Time In", r.time_out AS "Time Out",
CONCAT(c.fname,c.lname) AS Charlie, r.here AS "Apple",
r.leave AS "Dog"
FROM really r, georgia g, unit u, charlie c
WHERE g.id = r.georgia AND r.unit = u.id AND r.charlie = c.id
HAVING r.in = TRUE AND r.out = FALSE');
//fill fields array with fields from table in database
while ($x = mysqli_fetch_assoc($result))
{
$fields[] = $x['Field'];
}
$fields[] = $x['Field'];
由于这个词,我现在收到该行的错误Field
。为什么?因为我现在有一个完整的查询?如何在不引用每个字段名称的情况下解决此问题?