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()
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)
In [ ]:
In [ ]: