HTML DropDown with Mysqli数据和数据选择

HTML DropDown with Mysqli data and data selection

我有一个 html 下拉列表,它从 mysql table 获取数据。我有第二个 table,我可以在这里看到当天已经为其他用户选择了哪些设备。

我的问题是:

我的代码:

$BowDropDown = mysqli_query($mysqli, "SELECT * FROM equipment order by BowCode ASC");

while ($row = $BowDropDown->fetch_assoc()){

    if($row['BowCode'] != $BowDropDownDayCheck){}

    if($row['Recurve'] =='1'){
        $value = 'Recurve';
    } else if ($row['Compound'] == '1'){
        $value = 'Compound';
    } else if ($row['Longbow'] == '1'){
        $value ='Longbow';
    }
echo "<option value= " . $row['BowCode'] . ">" . $value . " - " . $row['BowCode'] . " - " . $row['Info'] . " - " . $row['Poundage'] . "</option>";
}

我不知道这是否可能,但也许下拉列表中显示的值可以像 table 视图一样可视化。

table from where the Equipment is stored

tabele where the users are stored with the Equipment the use for the day

这个就可以了

SELECT 
   b.id, b.BowCode, b.Info
FROM Equipment AS b
LEFT JOIN 
  (SELECT a.BowID
   FROM comeandtrydaysparticipant AS a
   WHERE a.`date`="2018-01-26"
   GROUP BY a.BowID
  ) AS c
ON c.BowID = b.BowCode
WHERE c.BowID IS NULL
;

它会选择特定日期不在 comeandtrydaysparticipant 中的所有项目。

还有 proof is in the pudding