比较两个变量php的正确方法

时间:2017-03-30 16:43:44

标签: php

我试图比较包含这些查询结果的2个变量

查询:

$cekFitur = mysqli_num_rows(mysqli_query($db,"SELECT * FROM selected_feature"));

$totalTerm = mysqli_num_rows(mysqli_query($db,"SELECT * FROM token_preprocessing_latih"));

if (($cekFitur && $totalTerm) == 0) {
    do something
}else{
    do something
}

这是检查这两个变量的正确方法吗?

请告诉我是否需要更改代码中的内容。 谢谢。

1 个答案:

答案 0 :(得分:1)

没有。 SELECT cust_code, cust_fname, cust_lname FROM lgcustomer join lginvoice USING (cust_code) WHERE employee_id = 83649 INTERSECT SELECT cust_code, cust_fname, cust_lname FROM lgcustomer join lginvoice USING (cust_code) WHERE employee_id = 83677 ORDER BY cust_lname, cust_fname; 正在比较

($cekFitur && $totalTerm) == 0 = ($var1 == true && $var2 == true) == 0 = true OR false == 0

这不是你想要的。你要单独比较它们。

1 OR 0 == 0