-1

このifステートメントは、固定ジョブと返されるべきではない他の結果の混合をもたらします。なぜこんなに単純なものが機能しないのか理解できません。

if($item["total_spent"] >= '1000' 
    && ($item["country"] == 'United States' || $item["country"] == 'Canada')
    && ($item["job_duration"] == '3 to 6 months' || $item["job_duration"] = 'More than 6 months') 
    && ($item["job_engagement"] == 'Full-time - 30+ hrs/week' || $item["job_engagement"] = 'Part-time - 10-30 hrs/week') 
    && ($item["job_type"] == 'Hourly') )
4

3 に答える 3

1

たぶん、あなたが意味するのはこれです:

if($item["total_spent"] >= '1000' 
        && ($item["country"] == 'United States' || $item["country"] == 'Canada')
        && ($item["job_duration"] == '3 to 6 months' || $item["job_duration"] == 'More than 6 months') 
        && ($item["job_engagement"] == 'Full-time - 30+ hrs/week' || $item["job_engagement"] == 'Part-time - 10-30 hrs/week') 
        && ($item["job_type"] == 'Hourly') )

=一部のwhere句でsingleが使用されていることに注意してください

于 2012-11-23T02:15:15.410 に答える
1

コードに偶発的な割り当てがいくつかあるようですが、次のように機能しますか?

<?php
if($item["total_spent"] >= '1000' 
            && ($item["country"] == 'United States' || $item["country"] == 'Canada')
            && ($item["job_duration"] == '3 to 6 months' || $item["job_duration"] == 'More than 6 months') 
            && ($item["job_engagement"] == 'Full-time - 30+ hrs/week' || $item["job_engagement"] == 'Part-time - 10-30 hrs/week') 
            && ($item["job_type"] == 'Hourly')
) {
    // ...
}
于 2012-11-23T02:16:54.720 に答える
1
$item["job_engagement"] = 'Part-time - 10-30 hrs/week'
$item["job_duration"] = 'More than 6 months'

これらの行は、値を割り当てているかのように記述されているため、次のようになります。

$item["job_engagement"] == 'Part-time - 10-30 hrs/week'
$item["job_duration"] == 'More than 6 months'
于 2012-11-23T02:17:50.540 に答える