Question: In my code I have a statement like this:

```
$last_100_char = substr($str[0], -100);

```

I want to retrieve the last 100 characters of the first element of an array, but while doing this I,m getting some error 

> 
> substr() expects parameter 1 to be string, array given.
> 
> 
> 

how to fix this?

Answer: 
You need `%` characters around the search text. Try this:

```
NSString *strSelectQuery = [NSString stringWithFormat:@"SELECT * FROM tblrestaurant WHERE address LIKE '%%%@%%'",txtField.text];

```

Note that the `%` symbols are escaped. So yes, that is three `%`, then the `@`, and then two more `%`.
SELECT \* FROM yourtable WHERE Name like '%%%Searchterm%%'