I'm trying to write a script to add some data to a table. This was just a test with two rows in it. Can anyone see why this doesn't insert any table rows, and why it doesn't generate any errors or warnings either?
I have MySQL 5.1 and the latest MySQLdb lib.
Thanks
import MySQLdb
import sys
if name == 'main':
try:
conn = MySQLdb.connect (host = "localhost",
user = "root",
passwd = "copters",
db = "birdlist")
except MySQLdb.Error, e:
print "Error %d: %s" % (e.args[0], e.args[1])
sys.exit (1)
cursor = conn.cursor ()
try:
cursor.execute ("INSERT INTO lister_species\
VALUES
('Ostrich', 'Struthio camelus', 'Struthioniformes', 'Sahel of North Africa and the Sudan', 'Ostrich', 'Struthionidae'), \
('2','3','4','5','6','7')\
I'm trying to write a script to add some data to a table. This was just a test with two rows in it. Can anyone see why this doesn't insert any table rows, and why it doesn't generate any errors or warnings either?
I have MySQL 5.1 and the latest MySQLdb lib.
Thanks
import MySQLdb
import sys
if name == 'main':
try:
conn = MySQLdb.connect (host = "localhost",
user = "root",
passwd = "copters",
db = "birdlist")
except MySQLdb.Error, e:
print "Error %d: %s" % (e.args[0], e.args[1])
sys.exit (1)
")
except MySQLdb.Error, e:
print "Error %d: %s" % (e.args[0], e.args[1])
sys.exit (1)