<reponame>Andyb1ance/iMED_web_front_end
import mysql.connector

connection = mysql.connector.connect(host='localhost',
                                             database='test',
                                             user='root',
                                             password='<PASSWORD>')

with open('./sample/13_left.jpeg',mode ='rb') as f:
    img = f.read()
print(type(img))
cursor = connection.cursor()
query = 'insert into mytable (fID,photo) values (%s,%s)'
cursor.execute(query,(0,img))
connection.commit()
cursor.close()
connection.close()
import mysql.connector

connection = mysql.connector.connect(host='localhost',
                                             database='test',
                                             user='root',
                                             password='<PASSWORD>')

with open('./sample/13_left.jpeg',mode ='rb') as f:
    img = f.read()
print(type(img))
cursor = connection.cursor()
query = 'insert into mytable (fID,photo) values (%s,%s)'
cursor.execute(query,(0,img))
connection.commit()
cursor.close()
connection.close()