SELECT多行WHERE匹配四个或更多条件

时间:2017-05-30 14:14:59

标签: php mysql

我的php代码选择有问题,   我想从满足四个条件的表中选择一行。

$course = $_GET['Course'];
$year_enrolled = $_GET['Year_Enrolled'];
$month = $_GET['Month'];
$year = $_GET['Year'];

$sql=" SELECT * FROM dtr WHERE Course like '%$course%' OR Year_enrolled like '%$year_enrolled%' AND Month like '%$month%' OR Year like '%$year%'";

1 个答案:

答案 0 :(得分:0)

本规范为我提供了这类问题的准确结果。

var checkboxSpans = document.querySelectorAll("span[for]");

for (var i = 0; i < checkboxSpans.length; i++) {
    var forCheckbox = checkboxSpans[i].getAttribute("for");
    forCheckbox = document.getElementById(forCheckbox);

    if (forCheckbox != null) {
        checkboxSpans[i].onclick = function (chk) {
            return function (e) {
                if (this === e.target) {
                    e.stopPropagation();
                    e.preventDefault();
                    if (chk.checked != true) {
                        chk.checked = true;
                    } else {
                        chk.checked = false;
                    }
                }
            }
        }(forCheckbox);
    }
}