mysqli_fetch_array的问题

时间:2018-05-11 19:01:59

标签: php mysql arrays database

我想将请求的结果放在此数组$dataPoints1 = array中,但它不起作用。

这是我的要求:

$sql = "
SELECT COUNT(id_etudiant)as nbre1 FROM suivre WHERE n_formation='1'
UNION 
SELECT COUNT(id_etudiant)FROM suivre WHERE n_formation='2'
UNION
SELECT COUNT(id_etudiant)FROM suivre 
WHERE n_formation='3'";

$result = mysqli_query($link,$sql);

while($row = mysqli_fetch_array($result)) { 
$dataPoints1 = array( 
    array("y" => ''. $row["nbre1"].'',"label" => "formation1" ),
    array("y" => ''. $row["nbre1"].'',"label" => "formation2" ),
    array("y" => ''. $row["nbre1"].'',"label" => "formation3" ),

);}

0 个答案:

没有答案