很确定这很容易,但我无法弄清楚,基本上是这样的简单查询:
$result = $mysqli->query("SELECT t.name FROM cups_participants cp
LEFT JOIN teams t on cp.team_id = t.team_id
WHERE cp.cup_id = '1'");
上面的查询应该从数据库中获取所有名称,现在我希望它像这样放入数组中:
$competitors = array(
'Paul A.M. Dirac',
'Hans Christian Oersted',
'Murray Gell-Mann',
'Marie Curie',
'Neils Bohr',
'Richard P. Feynman',
'Max Planck');
我如何将查询的结果放入上面的数组中?