In [26]:
import MySQLdb as db

connection = db.connect('127.0.0.1', 'root', '', 'pos')

cursor = connection.cursor()


cursor.execute("INSERT INTO `product` VALUES (%s, %s, %s, %s)",('','Shampo','5000','50',))
connection.commit()


/home/ypraw/anaconda3/lib/python3.6/site-packages/ipykernel/__main__.py:8: Warning: (1366, "Incorrect integer value: '' for column 'id' at row 1")

In [13]:
import MySQLdb as db

connection = db.connect('127.0.0.1', 'root', '', 'pos')

cursor = connection.cursor()

query = "SELECT * from product"

cursor.execute(query)
result = cursor.fetchall()
for items in result:
    print(items)


(1, 'Sabun Mandi Lux', 3500, 10)
(2, 'Marlboro Black Filter', 20700, 12)
(4, 'Sabun cuci Muka', 15000, 100)

In [ ]:


In [ ]: