Logic Programming Help - II

DarkPhazed

New Member
A \[code\]if ( ( empty($infoA) || empty($infoB) ) && ( !empty($inputA) && !empty($inputB) ) ) { //add}\[/code\]B\[code\]if ( ( !empty($infoA) || !empty($infoB) ) && ( empty($inputA) && empty($inputB) ) ){ //remove}\[/code\]C\[code\]if ( ( !empty($infoA) || !empty($infoB) ) && ( ($inputA != $infoA) || ($inputB != $infoB) ) ) { //add}\[/code\]So, in order to not repeat the add, we can:\[code\]if (A || C) { //add}elseif(B) { //remove}\[/code\]Any better logic to be applied here on your option?Context:I believe it's irrelevant what this should do. I mean, it's a logical question. :sNot sure what to write here... :(This is for a form: some inputs will come from the database, others from input fields.We are doing some comparisons here.A context:If the value that comes from the database is empty, and the input fields A and B are NOT empty, do add to database.B context:If the value that comes from the database is NOT empty, and the input fields A and B are empty, do remove from the database.C context:If the values that comes from the database are NOT empty, AND the input fieldA !equal infoA or input fieldB NOT equal database value infoB then, do add to the database.Please advice.MEM
 
Back
Top