fucking sql query 2

This commit is contained in:
lopar 2019-06-22 12:35:22 +03:00
parent cdbb724234
commit d9741c324a

View File

@ -104,13 +104,13 @@ class zayavka
$sql = db::c()->prepare('SELECT * FROM `zayavka` WHERE `level` = ?i', $razdel); $sql = db::c()->prepare('SELECT * FROM `zayavka` WHERE `level` = ?i', $razdel);
if (!is_null($level)) { if (!is_null($level)) {
$sql .= db::c()->prepare('AND (`t1min` <= ?i OR `t1min` = 99) AND (`t1max` >= ?i OR `t1max` = 99)', $level, $level); $sql .= db::c()->prepare(' AND (`t1min` <= ?i OR `t1min` = 99) AND (`t1max` >= ?i OR `t1max` = 99)', $level, $level);
if (4 == $razdel) { if (4 == $razdel) {
$sql .= db::c()->prepare('AND (`t2min` <= ?i OR `t2min` = 99) AND (`t2max` >= ?i OR `t2max` = 99)', $level, $level); $sql .= db::c()->prepare(' AND (`t2min` <= ?i OR `t2min` = 99) AND (`t2max` >= ?i OR `t2max` = 99)', $level, $level);
} }
} }
if (!is_null($id)) { if (!is_null($id)) {
$sql .= db::c()->prepare('AND `id` = ?i', $id); $sql .= db::c()->prepare(' AND `id` = ?i', $id);
} }
$fict = db::c()->query($sql); $fict = db::c()->query($sql);