Reputation: 871
.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?")
{
.some code..
}
else
{
.some code..
}
.TIA guys! More power!
Upvotes: 0
Views: 92
Reputation: 48131
if (strpos($fieldFromDatabase,'SGA')!==false) {
} else {
}
If you need case insenstive you can use stripos
php>5.0
Upvotes: 1