Commit 394fc21b authored by Lihinikaduwa D.N.R.  's avatar Lihinikaduwa D.N.R.

Merge branch 'it18257632' into 'master'

insert function

See merge request !152
parents 0677c44e a8065144
......@@ -173,3 +173,17 @@ def update_data(sql_query):
db.close()
print(e)
return e
def insert(sql_query, args):
db = create_con()
cursor = db.cursor()
try:
cursor.execute(sql_query, args)
db.commit()
db.close()
return 1
except Exception as e:
db.rollback()
db.close()
print(e)
return e
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment