I am very new in php. I am having a problem in condition checking. I have the condition chain like this
if(condition1){
if (condition2){
Statement1;
}else{
Statement2;
}
else{
if (same condition2){
Statement3;
}else{
Statement4;
}
Now when I am writing this like I am having errors –
if (condition1) "AND". (condition2)
Statement1;
if (condition1) "AND". (!condition2)
Statement2;
if (!condition1) "AND". (condition2)
Statement3;
if (!condition1) "AND". (!condition2)
Statement4;
Can anyone enlighten me where I am wrong?
Here is the real code I am writing –
if (!isset($store['stationfilter'])) "AND". ($fromdate_display == $todate_display)
$storeSql_current = sprintf($sql_current, ''); //error 1
if (!isset($store['stationfilter'])) "AND". (!$fromdate_display == $todate_display) //error2
$storeSql_otherThancurrent = sprintf($sql_otherThancurrent, ''); //error3
if (isset($store['stationfilter'])) "AND". ($fromdate_display == $todate_display) //error4
$storeSql_current = sprintf($sql_current, "AND" . $store['stationfilter']); //error5
if (isset($store['stationfilter'])) "AND". (!$fromdate_display == $todate_display) //error6
$storeSql_otherThancurrent = sprintf($sql_otherThancurrent, "AND" . $store['stationfilter']); //error7
Please tell me where I am wrong.
Thanks,
Neel
You should write like this: