I'm very newbie to python and how its mysql connector works in any web application. I want to try something easy actually but got no idea how to work it out. I have this simple python script to make random numbers and allocate it in a variable. (numbers.py)
import random
number = random.radint(1,1000)
print number
and this very simple python script to make a table in a mysql database (try.py)
import MySQLdb as mdb
con = mdb.connect('localhost', 'testuser', 'test623', 'testdb');
with con:
cur = con.cursor()
cur.execute("DROP TABLE IF EXISTS Table_Try")
cur.execute("CREATE TABLE Table_Try(Value INT)")
My question is how do I insert the field "Value" with the value from variable "number" in number.py, since they are different scripts. When the value is inserted, how do I displayed in a php page so it can show random values repeatedly in a endless loop when opened? I have searched tutorial links about this in google but none could answer my problem here.