我有 3 个查询。我希望它们全部 3 一次运行并显示结果。这是我的代码:
$query = mysqli_query($connect ,"SELECT w2.Avis as Avis,w2.Cde_Sap,w2.Don_Ordre,w2.Num_cde_cl,w2.PN_in ,w2.SN_in,w2.DATE2,w2.Statut_Cde,client.Zone
FROM w2
INNER JOIN client
ON w2.Don_Ordre = client.Client
WHERE client.Zone='AFZ'
UNION ALL
SELECT w3.Avis,w3.Cde_Sap,w3.Don_Ordre,w3.Num_cde_cl,w3.PN_in ,w3.SN_in,w3.DATE2,w3.Statut_Cde,client.Zone
FROM w3
INNER JOIN client
ON w3.Don_Ordre = client.Client
WHERE client.Zone='AFZ'
ORDER BY Avis DESC;") ;
查询 2
$query2= "SELECT SUBSTRING_INDEX(w2.Statut_Cde, ' ', -1) FROM w2;";
查询 3
$query3 = "SELECT SUBSTRING_INDEX(w3.Statut_Cde, ' ', -1) FROM w3;" ;
表格展示
<?php
while($w2= mysqli_fetch_assoc($query)){
echo"<tr>";
echo"<td>".$w2['Avis']."</td>";
echo"<td>".$w2['Cde_Sap']."</td>";
echo"<td>".$w2['Don_Ordre']."</td>";
echo"<td>".$w2['Num_cde_cl']."</td>";
echo"<td>".$w2['PN_in']."</td>";
echo"<td>".$w2['SN_in']."</td>";
echo"<td>".$w2['DATE2']."</td>";
echo"<td>".$w2['Statut_Cde']."</td>";
echo"<td>".$w2['Zone']."</td>";
// echo"<td>".$w2['Comment']."</td>";
}//end while
while($w3= mysqli_fetch_assoc($query)){
echo"<tr>";
echo"<td>".$w3['Avis']."</td>";
echo"<td>".$w3['Cde_Sap']."</td>";
echo"<td>".$w3['Don_Ordre']."</td>";
echo"<td>".$w3['Num_cde_cl']."</td>";
echo"<td>".$w3['PN_in']."</td>";
echo"<td>".$w3['SN_in']."</td>";
echo"<td>".$w3['DATE2']."</td>";
echo"<td>".$w3['Statut_Cde']."</td>";
echo"<td>".$w3['Zone']."</td>";
// echo"<td>".$w3['Comment']."</td>";
}//end while
?>
帮助执行 3 个查询。