March 2nd, 2006, 04:08 PM
Inserting values into MySQL table
I am using the Python MySQL module to create a table and insert values into it.
I use the following code:
which shows the results;
CREATE TABLE animal
INSERT INTO animal (name, category)
cursor.execute ("SELECT name, category FROM animal")
row = cursor.fetchone ()
if row == None:
print "%s, %s" % (row, row)
However, when I look at the table using the MySQL command prompt, the table is created but it's empty. What could be the reason? Is it a temporary insertion that my code does?
Thanks for your help.
March 2nd, 2006, 04:52 PM
No such thing as a temporary insertion, and that all looks fine to me. Double check you're looking at the same database and directory.