How do i fetch values from a table which will contain 2 characters
Example, field contains:
1. A123BCDE
2. A123CDEB
3. A123CEBF
4. A12CEBD3
and i want all the field values which contain CD.
i should get
1
2
4
Comparing string
Moderator: General Moderators
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Re: Comparing string
shivam0101 wrote:How do i fetch values from a table which will contain 2 characters
Example, field contains:
1. A123BCDE
2. A123CDEB
3. A123CEBF
4. A12CEBD3
and i want all the field values which contain CD.
i should get
1
2
4
Code: Select all
if (strstr($input, "C") && strstr($input, "D")) {
//Then $input contains both C and D
}-
shivam0101
- Forum Contributor
- Posts: 197
- Joined: Sat Jun 09, 2007 12:09 am
Code: Select all
select string_field from strings_table where string_field like '%CD%'