I have a database named user and a table named Employee. Now I want a python program that can append the details of a user in the table(employee).
for linux the code is:
mysql -u root -proot
|>use user;
|>show tables;
|>insert into Employee(name,age,salary)
->values("jack","25","10000");
i am now using python:
n='jack'
a='25'
sal='10000'
import MySQLdb
x=MySQLdb.connect('localhost','root','root')
y=x.cursor()
y.execute('use user;')
sql='''insert into employee(name,age,salary)
values('''+n+''','''+a+''','''+sal+''');'''
y.execute(sql)
x.commit()
Using the above python code i am unable to append the details of the user inside the table employee. Please help! THANK YOU.