开发者

search certain characters in an if statement

.what i want to do is search for certain Initials inside a retrieved record from a database. for example i have a record like this.. "SGA, MNFA, JGA" how do I code an If statement that will search if SGA is present inside the record. If it is found then proceed, if not, then an else statement will be performed.

sample:

if($x == "what is the code needed to be placed here to search if SGA is present?"开发者_Go百科)
{
    .some code..
}
else
{
    .some code..
}

.TIA guys! More power!


if (strpos($fieldFromDatabase,'SGA')!==false) {


} else {


}

If you need case insenstive you can use stripos php>5.0

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜