I have multiple arrays similar to below.
{
["sku_original"]=>
string(33) "98iuoo"
["po"]=>
string(5) "9897"
["ca"]=>
string(3) "557"
["cl"]=>
string(5) "33"
["aa"]=>
string(3) "80"
["ad"]=>
NULL
["da"]=>
string(4) "143.9"
["dr"]=>
NULL
["cors"]=>
NULL
}
I want to use IS NULL
condition when a value is null in the array else I have to check equal to
condition if not empty.
I have tried something like below.
$po = $option['po'] != NULL ? $option['po'] : NULL ;
$ca = $option['ca'] != NULL ? $option['ca'] : NULL ;
$cl = $option['cl'] != NULL ? $option['cl'] : NULL ;
$aa = $option['aa'] != NULL ? $option['aa'] : NULL ;
$ad = $option['ad'] != NULL ? $option['ad'] : NULL ;
$da = $option['da'] != NULL ? $option['da'] : NULL ;
$dr = $option['dr'] != NULL ? $option['dr'] : NULL ;
$cors = $option['cors'] != NULL ? $option['cors'] : NULL ;
The above code is not assigning value to a variable if option index is null I also tried is_null.
and SQL like below.
$sql = "SELECT abc FROM `abc` WHERE `po` = $po AND `ca` = $ca AND `cl` = $cl AND `aa` = $aa AND `ad` = $ad AND `da` = $da AND `dr` = $dr AND `dr` = '$dr' AND `cors` = '$cors' `sku` = '$sku' ";
I have to check IS NULL
in SQL when value is null else I have to use equal to