MySQLdb not updating rows
Fredrik Lundh
fredrik at pythonware.com
Wed Jun 28 09:26:08 EDT 2006
"Bowen" <simon at xiano.co.uk> wrote:
> boo = raw_input("Sure you want to update password with above details? Y or N: ")
>
> if boo == 'y':
if you're asking for Y or N, maybe you should check for Y or N ? or better,
use something like:
if boo.lower() == 'y':
...
or even
if boo.lower().startswith("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()
what happens if you add
db.commit()
here?
> db.close()
</F>
More information about the Python-list
mailing list