Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

php conditional region

Status
Not open for further replies.

darryncooke

Technical User
May 6, 2009
308
0
0
US
so I have a query which selects distinct items from a column.

I want to hide a selection of text if said column contains a string.

right now I am using

if ($row_recordsetname['column_name']=='string'

but I only want it to check if "string" exists in said field NOT "string" being the actual value. So if the field contains "my big string pool" then I want this to be true.

Darryn Cooke
| The New Orange County Graphic designer and Marketing and Advertising Consultant
| Marketing and Advertising blog
 
Use the strpos() function.

Code:
if(strpos($mystring,$sectiontofind)){
...
}

Strpos will return the position of the string or false if it can't find it.



----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top