Light sensor Python script

“””script to read a Light Dependent Resistor on GPIO pin 11
must be run in command line:
–login as root
>sudo su
— run python command from directory
>python lightsensor.py
— ctrl-C to quit
“””
#!/usr/bin/python
import time
import os
import RPi.GPIO as GPIO

GPIO.setmode(GPIO.BOARD)

def LDRtime(LDRpin):
reading = 0
GPIO.setup(LDRpin, GPIO.OUT)
GPIO.output(LDRpin, GPIO.LOW)
time.sleep(0.1)

GPIO.setup(LDRpin, GPIO.IN)
while (GPIO.input(LDRpin) == GPIO.LOW):
reading += 1
return reading

while True:
print LDRtime(11)

“””
put LDRtime into a variable
see if LDRtime is higher than a certain value
if it is send a 1 to the MySQL database with timestamp
if it goes lower than a certain value then send a 0 to the MySQL database with timestamp

“””

NOTE: paste code from editable post to preserve indents.