PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
Todlerone
Forum Commoner
Posts: 96 Joined: Sun Oct 28, 2007 10:20 pm
Location: Hamilton, Ontario, Canada
Post
by Todlerone » Wed Mar 05, 2008 3:43 pm
Hello everyone, as per protocol...thank-you in advance for help. Sorry if this questions is extremely NOOB. Can I use the loop expression:
Code: Select all
if ($row[6] !="CANC" or $row[6] !="R" or $row[6] !="R1"){
//something
}else{
//something
}
Thank-you
Last edited by
Todlerone on Wed Mar 05, 2008 4:50 pm, edited 4 times in total.
Zoxive
Forum Regular
Posts: 974 Joined: Fri Apr 01, 2005 4:37 pm
Location: Bay City, Michigan
Post
by Zoxive » Wed Mar 05, 2008 3:54 pm
IF is not a loop, and you have a syntax error at the end of your conditional statement.
And having }elseif(){} is pointless, its like its not even there.
Todlerone
Forum Commoner
Posts: 96 Joined: Sun Oct 28, 2007 10:20 pm
Location: Hamilton, Ontario, Canada
Post
by Todlerone » Wed Mar 05, 2008 4:02 pm
I know the elseif part, there is code for that, I'm more interested if the first part of the loop can proceed given the expression. Thank-you
Sekka
Forum Commoner
Posts: 91 Joined: Mon Feb 18, 2008 10:25 am
Location: Huddersfield, West Yorkshire, UK
Post
by Sekka » Wed Mar 05, 2008 4:32 pm
Your syntax is all wrong.
Code: Select all
if ($row[6] != "CANC" || $row[6] != "R" || $row[6] != "R1") {
// Something
} else {
// Something else
}
Todlerone
Forum Commoner
Posts: 96 Joined: Sun Oct 28, 2007 10:20 pm
Location: Hamilton, Ontario, Canada
Post
by Todlerone » Wed Mar 05, 2008 4:46 pm
How would one proceed given the need to verify the control structure. Would I use a SWITCH loop with a called function (to complete the same block of code for each of the cases? I was hoping I could use a loop with the three conditions in the control structure. Basically I want the main big loop to start if my array at $row[6] doesn't equal "CANC, R or R1"
Thanks
Sekka
Forum Commoner
Posts: 91 Joined: Mon Feb 18, 2008 10:25 am
Location: Huddersfield, West Yorkshire, UK
Post
by Sekka » Wed Mar 05, 2008 4:48 pm
Basically I want the main big loop to start if my array at $row[6] doesn't equal "CANC, R or R1"
The IF statement I posted seems to accomplish that task easily.
Todlerone
Forum Commoner
Posts: 96 Joined: Sun Oct 28, 2007 10:20 pm
Location: Hamilton, Ontario, Canada
Post
by Todlerone » Wed Mar 05, 2008 4:52 pm
Sekka wrote: Basically I want the main big loop to start if my array at $row[6] doesn't equal "CANC, R or R1"
The IF statement I posted seems to accomplish that task easily.
Sorry Sekka, misunderstood your reply. Thank-you. I will give it a try. CHEERS