multiple arguments in sqflite flutter

279

This works.

await database.rawQuery(
        'SELECT * FROM docs WHERE title LIKE ? OR content LIKE ?',
        ['%$keyword%', '%$keyword%']);

Share:
279
Mahi
Author by

Mahi

Updated on January 03, 2023

Comments

  • Mahi
    Mahi over 1 year

    I want to search database based on the keyword. if it title or content contains the keyword then return the data. but it send backs nothing.

    
      static Future<List<Note>> searchDocuments(String? keyword) async {
        final database = await DatabaseHelper.database();
     
        List<Map<String, dynamic>> allDocuments = await database.rawQuery(
            'SELECT * FROM docs WHERE title=? and content=?',
            ['$keyword%', '$keyword%']);
    
    
    

    checked - doesn't work.

  • Mahi
    Mahi about 2 years
    (1) no such column: b in "SELECT * FROM docs WHERE title=b OR content=b"