While loop
hello everyone.
i have a program that is in a while loop using the select command to read a table from sql.
conn = MySQLdb.Connect(host='localhost', user='root', db='database', passwd='password')
curs = conn.cursor()
while 1:
curs.execute('select * from table')
print curs.fetchall()
And i have another program that inserts rows on the table.
The thing is that the program that reads the table won't read the updated information.. he just keeps reading what he had read when it started. But if I make a connection to the database before each read to the table the program will show updated information..:
while 1:
conn = MySQLdb.Connect(host='localhost', user='root', db='database', passwd='password')
curs = conn.cursor()
curs.execute('select * from table')
print curs.fetchall()
ins't there any other way to do this? thanks
Subject
Written By
Posted
While loop
September 16, 2008 08:50AM
September 16, 2008 11:32AM
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.