By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,751 Members | 1,158 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,751 IT Pros & Developers. It's quick & easy.

if elseif not working

P: 22
Hy guys , I try to make conditional statement by using if and elseif .
the problem are if i use 2 conditional statement the script run well but if try add more conditinal statement it's not working only 2 conditional it select.
thanks to help me
my script
[PHP] //condtional//
if ($ttl_dur > 10 and $bay!=$stand and $dpt_reg[categori]==0){
}elseif($ttl_dur > 15 and $bay==$stand and categori==0){
}elseif($ttl_dur > 20 and $bay!=$stand and $dpt_reg[categori]==1){
}elseif($ttl_dur > 25 and $bay==$stand and categori==1){
}elseif($ttl_dur2 > 20 and $dpt_reg[categori]==0){
}elseif($ttl_dur2 > 25 and $bay==$stand and categori==0){
}elseif($ttl_dur2 > 40 and $dpt_reg[categori]==1){
}elseif($ttl_dur2 > 45 and $bay=="r61" and $dpt_reg[categori]==1){
$fail=0;} [/PHP]
May 4 '07 #1
Share this Question
Share on Google+
3 Replies

code green
Expert 100+
P: 1,726
but if try add more conditinal statement it's not working
It's not working is not enough information! Why is it not working? Syntax, logic. Are you getting errors? If not you should be.
May 4 '07 #2

Expert 100+
P: 404
I have taken a look at your code and given the sparse detail on your error I am assuming you want the test to happen at every elseif level - whilst elseif will nest, the first elseif expression (if any) that evaluates to TRUE would be executed only - If I have got the wrong end of the stick supply additional info on your problem..
May 4 '07 #3

Expert 5K+
P: 5,821
Is categori a constant or a variable? Should it be $categori instead?
May 5 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.