I am trying to search in my mysql database with LIKE statement :
indexstr = request.GET['index']
indexstr = '%' + indexstr + '%'
offset = int(request.GET['offset'])
for row_data in advertisement.objects.raw(
'select * from requests_advertisement WHERE short_description LIKE ' + indexstr + ' LIMIT 10 OFFSET ' + str(offset*5)):
But it has this error: Error Image
It seems that it cannot work with % character. When I remove % it works correctly.
cursor.execute("""select * from requests_advertisement WHERE short_description LIKE %s""", ('%' + indexstr + '%',))