这里有一个示例查询以获取两种类型的图标..
$fetchIcon = array();
$queryIcon = $db->query("SELECT * FROM icon_code WHERE icon_type = 'icon'");
while ($fIcon = $db->fetch_assoc($queryIcon)) {
$fetchIcon[] = $fIcon;
}
$fetchOther = array();
$queryOther = $db->query("SELECT * FROM icon_code WHERE icon_type = 'other'");
while ($fOther = $db->fetch_assoc($queryOther)) {
$fetchOther[] = $fOther;
}
然后我用来foreach
在同一页面上显示输出。
foreach ($fetchIcon as $Icon) {
echo $Icon['IconName']; // select option for Icon
}
foreach ($fetchOther as $Other) {
echo $Other['IconName']; // select option for other icon
}
问题: 如何将两条语句结合起来进行一次查询?