[Solved] Python – MySQLi parametized query with %d


Just solved it myself by using:

try:
  query = """SELECT * FROM `v_someview` WHERE `id` = %s LIMIT %s;"""
  x.execute(query,(str(id),int(l)))
except Exception as ex:
  #some code

So I’m declaring that i’m going to use a string (%s) but casting that parameter to an int().

2

solved Python – MySQLi parametized query with %d