Skip to content Skip to sidebar Skip to footer

Fmdb Query Isn't Acting Right With Like

I am using FMDB, which is a wrapper for SQLite. http://github.com/ccgus/fmdb Here is my query line: FMResultSet *athlete = [db executeQuery:@'SELECT * FROM athletes WHERE athlete_n

Solution 1:

The wildcard characters (%) have to be part of the substituted variable, not the query string:

FMResultSet *rs = [db executeQuery:@"SELECT * FROM athletes WHERE athlete_name LIKE ?",
                  [NSString stringWithFormat:@"%%%@%%", search_text]];

Post a Comment for "Fmdb Query Isn't Acting Right With Like"