2
whileループの助けを借りて、最初のクエリのフェッチ値を2番目のクエリのwhere条件として使用しようとしています。私が欲しいのは: A B C D E のようなすべての値に対して実行します。 最初の値で実行します。 ここに私のコードがあります。クエリ内部whileループは最初の値に対してのみ実行します
<?php
$qu="Select DISTINCT Branch from branch";
$res=mysqli_query($con,$qu);
if($res && mysqli_num_rows($res)>0)
{
while($row=mysqli_fetch_assoc($res))
{
$br=$row['Branch'];
$qu="select count(P_no) as pick from add_new_patient where Branch='$br' and Result='POSITIVE'";
$res=mysqli_query($con,$qu);
if($res && mysqli_num_rows($res)>0)
{
while($row=mysqli_fetch_assoc($res))
{
$rs=$row['pick'];
echo "<tr><td>$br</td><td>$rs</td>";
}
}
}
}
?>
投稿された回答を確認してください – Tarun