We help IT Professionals succeed at work.
Get Started

CFIf Syntax and Logic

mounty95 asked
Last Modified: 2017-02-16
I have a webpage that inserts array values into a database based on the criteria that the value in one of the fields is not equal to zero.  So I have:
YearArray:  2014, 2015, 2016
AmountArray:  100,0,0

The insert will only insert a single record with the 2014 and the 100 into the table.

Now the process has changed and the user wants to be able to insert a record where there is a zero in one of the array positions something like:
YearArray:  2014, 2015, 2016
AmountArray:  0,,

So I am thinking that I would want to test for not equal to "", but I am having difficulty.  Do I need a separate if evaluation or do I want to have a compound evaluation of if not equal to zero OR not equal to ""?  I am not sure of the placement whether I should evaluate for the "" before the 0 or after the 0 evaluation.

Also if the user has this array, how do I ensure that the right position of the array is inserted into the database if the data was:

YearArray:  2014, 2015, 2016
AmountArray:  ,0,

Thank you for any help that you can provide.  I can provide the actual page code if it helps, there is just a lot more to the page that complicates it that I didn't think would help in answering this question.
Watch Question
Most Valuable Expert 2015
This problem has been solved!
Unlock 1 Answer and 27 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE