I have a table of students in which I have few columns like ID,Name,Class,Subject,Marks Now in my table I have these records
I like to apply IF conditions and show only those records who are having class 5th and 4th and if class is not equal to 5th or 4th then I wanted to show a message.
the issue is explained below
if(st.class!="5th")
{
Print My Message
}
if(st.class!="4th")
print my message
This issue is that even if my student is having class "4th" then it still shows the message because it execute the first if condition and it shows the message,it should not show as my second if has class 4th which .
THE ISSUE IS like IF A STUDENT IS HAVING CLASS 4th that is allowed class but the first IF already run and it shows the message how to combine these two if in one if I make the statement like this
if(st.class!="4th" || st.class!="5th") (THEN FROM IT AS IT IS OR OPERATOR IF ONE CONDITION IS TRUE IT WILL BE TRUE , the student must have either 4th or 5th class not both