I'm trying to send a query through Django python I also try to block any sql injection exploits
Can someone explain to me how messaging is done LIKE Query for example
"SELECT * FROM admin WHERE name LIKE '%myTitle%'
It's easy to configure Query like this
cursor.execute("SELECT * FROM admin WHERE name= %s", (_id, ))
;
But when inserting %s Many errors are made when canceling %% From the text, for example
SELECT * FROM admin WHERE name LIKE %s
When Query Done it be like
SELECT * FROM admin WHERE name 'MyTitle'
It is being implemented correctly, but I want it to be set %% among %s LIKE
SELECT * FROM admin WHERE name '%MyTitle%'
Can someone explain to me how to solve this problem
my Simple Script
from django.db import connection
title = "myTitle"
query = "SELECT * FROM admin WHERE name LIKE %s"
with connection.cursor() as cursor:
cursor.execute(query, (title,))