MySQLdb not updating rows
import md5
import string
import MySQLdb
tc = raw_input("Teacher Code: ")
p = raw_input("New Password: ")
print tc
hash = md5.new()
hash.update(p)
print p
print hash.hexdigest()
h = hash.hexdigest()
boo = raw_input("Sure you want to update password with above details? Y
or N: ")
if boo == 'y':
db = MySQLdb.connect("copweb2", "**", "**", "***")
cursor = db.cursor()
if cursor.execute("UPDATE teachers SET password = '%s' WHERE
teacher_code = '%s'" % (h, tc)):
print "Done"
else:
print "Error"
else:
print "cancelled"
cursor.close()
db.close()
This code doesn't seem to update my database, anyone any idea why? Is
it me being stupid? It doesn't kick out an error at all.
--
http://mail.python.org/mailman/listinfo/python-list
Re: MySQLdb not updating rows
Thanks for that, it appears it was the db.commit() that sorted it out.lesson learnt :) -- http://mail.python.org/mailman/listinfo/python-list
Re: MySQLdb not updating rows
Thanks for that tip, it's a simple script that I am experimenting on, planning to build a custon gui for my database. It is definately something for me to note in the future. Thanks again. -- http://mail.python.org/mailman/listinfo/python-list
Pygtk Image Load Problem
Hey I have a simple image load written in Python. Here is a link to the pastebin http://pastebin.com/m490093b3 I am having a problem when loading the full screen images, it is displaying a gray line at the bottom of the image as can be seen in this screen shot http://www.xiano.co.uk/image_load.png I suspect its some sort of buffering problem but I am not sure how to work around it. It is worse on some images than others, but the gray line is still there. I need the image to display full screen without any defects. If anyone could help that'd be great, I am fairly desperate to get this working! Simon -- http://mail.python.org/mailman/listinfo/python-list
