Sorry for my English.
Today one of my friends ask me why the above statement always go to else even the if statement is true. He is using MS SQL for database.
In my experience, this problem course by the mssql itself. The value it return is not "Yes" (in this case) even when we echo it, it will print Yes. So, to prevent this just "trim" the value like:
Problem solve.
$value = "[Data take from MS SQL value is Yes]" if($value == "Yes"){ "something happen" } else { "something happen" }
In my experience, this problem course by the mssql itself. The value it return is not "Yes" (in this case) even when we echo it, it will print Yes. So, to prevent this just "trim" the value like:
$value = "[Data take from MS SQL value is Yes]" if(trim($value) == "Yes"){ "something happen" } else { "something happen" }
Problem solve.
0 comments:
Post a Comment
Comments with facebook.