嗨,我有查詢問題,其中吸取自由的地方,並採取座位,然後檢查在循環PHP我寫忙碌地爲禁用複選框SQL,查詢到電影院的地方
我嘗試:
foreach ($FreePlaces as $item) {
foreach ($busyPlaces as $items) {
if ($item->id_place == $items->id_place) {
echo Html::checkboxList('items', null, [$items->id_place => $items->number_place], ['class' => 'checkbox-inline no_indent', 'id' => 'idd']);
}
else
echo Html::checkboxList('items', null, [$item->id_place => $item->number_place], ['class' => 'checkbox-inline no_indent', 'id' => 'idd']);
}
}
如何標記爲禁用的繁忙地點?
$freePlace= place::find()
->Where(['id_room' => seanse::find()->select('id_room')->
Where(['id_seans' => $id])])->all();
$busyplace=place::find()->where(['in', 'id_place', Reservation::find()->select('id_place')
->where(['id_seans' => $id])])
->andWhere(['id_room' => seanse::find()->select('id_room')->
Where(['id_seans' => $id])])->all();
解決方案
jQuery的
$("input[name='items[]']:checked").prop("disabled", true);
PHP
$selectedArray = [];
foreach ($zajeteKrzesla as $items) {
$selectedArray[] = $items->id_place;
}
foreach ($WolneKrzesla as $item):?>
echo Html::checkboxList('items', $selectedArray, [$item->id_place => $item->number_place], ['class' => 'checkbox-inline no_indent', 'id' => 'idd']);
<?php endforeach;
你有問題要問? –