mysql Unread result found code example
Example 1: mysql Unread result found
/* If you looping through cursor & running another query,python no like*/
/* Store results into list first then loop again running query*/
/* So something like this*/
results = list()
for (id,fname,lname) in cursor:
results.append({"id":id,"fname":fname,"lname":lname})
for r in results:
id=r['id']
query = ("update user set fname='whatever' where id = "+str(id))
cursor.execute(query)
cnx.commit()
Example 2: mysql Unread result found
cursor = cnx.cursor(buffered=True)