Empty table in MySQL even though Python can insert data into table -


i'm new mysql , python.

i have code insert data python mysql,

conn = mysqldb.connect(host="localhost", user="root", passwd="kokoblack", db="mydb") in range(0,len(allnames)):     try:         query = "insert resumes (applicant, jobtitle, lastworkdate, lastupdate, url) values ("         query = query + "'"+allnames[i]+"'," +"'"+alltitles[i]+"',"+ "'"+alldates[i]+"'," + "'"+allupdates[i]+"'," + "'"+alllinks[i]+"')"         x = conn.cursor()         x.execute(query)         row = x.fetchall()     except:         print "error" 

it seems working fine, because "error" never appears. instead, many rows of "1l" appear in python shell. however, when go mysql, "resumes" table in "mydb" remains empty.

i have no idea wrong, not connected mysql's server when i'm viewing table in mysql? please.

(i use import mysqldb, enough?)

use commit commit changes have done

mysqldb has autocommit off default, may confusing @ first

you commit

conn.commit() 

or

conn.autocommit(true) right after connection created db 

Comments

Popular posts from this blog

Android : Making Listview full screen -

javascript - Parse JSON from the body of the POST -

javascript - Chrome Extension: Interacting with iframe embedded within popup -