Code not working
I am trying to run this basic mySQL code but it just does not seem to work.
The table is successfully created but the record is not added.
The same command when typed from the mysql prompt seems to work fine.
Any ideas?
try:
cursor = conn.cursor()
cursor.execute ("DROP TABLE IF EXISTS blenders")
cursor.execute ("""
CREATE TABLE blenders(
productID CHAR,
reviewerID CHAR,
date CHAR,
reviewtype CHAR,
filename CHAR,
productrating CHAR,
easeofuse CHAR,
easeofcleaning CHAR,
durability CHAR,
style CHAR,
pros CHAR,
cons CHAR,
contents CHAR)
""")
cursor.execute("""
INSERT INTO blenders (productID, reviewerID)
VALUES ('test', 'test')
""")
except MySQLdb.Error, e:
print "Error %d: %s" % (e.args[0], e.args[1])
Subject
Written By
Posted
Code not working
June 05, 2006 10:42AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.