I'm wondering if I can speed my process up, and this is the only area where I'm thinking it might be taking longer than necessary.
Basically, I'm running different select statements in db2 and mysql. I load those results in arrays to prepare them for comparison. Then I'm taking the count arrays and using them as conditions in my if statements.
The problem is I have 3 sections of IF/ELSE and the first 2 do the same exact thing (performing the same exact insert statement, just based on 2 different conditions).
$count3 holds records that exist in the table and have expired
$count4 holds records that exist in the table and have not expired
So if they're both empty, that means records don't exist so I insert. If $count3 is not empty, that means those records have expired so I insert also. If $count4 is not empty, that means records haven't expired so I update. I'm wondering if the redundancy if these first two IF/ELSE blocks are making it take longer than it could.
Here's the code:
if(empty($count3) && empty($count4)){
//execute query 1
}
elseif(!empty($count3)){
//execute query 1
}
elseif(!empty($count4)){
//execute query 2
}
Is there a better way to say something like:
if (count3 and count4 are BOTH empty) OR if(count3 is not empty){
insert
}elseif(count 4 is not empty){
updated
}