Skip to main content
Tweeted twitter.com/#!/StackProgrammer/status/533317108583510016
spelling and personal stuff cleanup
Source Link
gnat
  • 20.5k
  • 29
  • 117
  • 310

Is this code perfect totype of data insertion safe and can stop sql injection in pythonPython?

I'm new to python and iI am learning Database connection from hereMySQL Connector/Python Developer Guide.

This is the code iI am using to insert data:

conn = mysql.connector.connect(user="user", password="password", host="127.0.0.1", database="db")
cursor = conn.cursor()
query = ("INSERT INTO test(name,email) VALUES(%s,%s)")
data = ("cool", "cool")
cursor.execute(query, data)
conn.commit()
cursor.close()
conn.close()

ThisIs this type of data insertion is safe and can stop sql injection  ?

Is this code perfect to stop sql injection in python?

I'm new to python and i am learning Database connection from here

This is the code i am using to insert data:

conn = mysql.connector.connect(user="user", password="password", host="127.0.0.1", database="db")
cursor = conn.cursor()
query = ("INSERT INTO test(name,email) VALUES(%s,%s)")
data = ("cool", "cool")
cursor.execute(query, data)
conn.commit()
cursor.close()
conn.close()

This type of data insertion is safe and can stop sql injection  ?

Is this type of data insertion safe and can stop sql injection in Python?

I am learning Database connection from MySQL Connector/Python Developer Guide.

This is the code I am using to insert data:

conn = mysql.connector.connect(user="user", password="password", host="127.0.0.1", database="db")
cursor = conn.cursor()
query = ("INSERT INTO test(name,email) VALUES(%s,%s)")
data = ("cool", "cool")
cursor.execute(query, data)
conn.commit()
cursor.close()
conn.close()

Is this type of data insertion safe and can stop sql injection?

Source Link
CS GO
  • 111
  • 3

Is this code perfect to stop sql injection in python?

I'm new to python and i am learning Database connection from here

This is the code i am using to insert data:

conn = mysql.connector.connect(user="user", password="password", host="127.0.0.1", database="db")
cursor = conn.cursor()
query = ("INSERT INTO test(name,email) VALUES(%s,%s)")
data = ("cool", "cool")
cursor.execute(query, data)
conn.commit()
cursor.close()
conn.close()

This type of data insertion is safe and can stop sql injection ?