Select data from MySQL database and make it a value using Python -
i using python 2.7 , mysqldb. have created table called table1 has 2 fields (id, id2).
-id field -234 -490 -678 -566 -569 -id2 field -10 -29 -78 -46 -59
i want script make row's id2 variable(value) in order send email or print it. there specific reason why want value. example, want select row id=678, , automatically id2 of row variable, variable can use in other lines of script.
use execute
run mysql select
command:
db.execute("select id2 my_table id = '%s';" % user)
(user id want select from)
edit: yes, need follow data = cursor.fetchall()
!
Comments
Post a Comment