开发者

search certain characters in an if statement

开发者 https://www.devze.com 2023-03-09 08:59 出处:网络
.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 i

.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

精彩评论

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