Send DATA to database from arduino (not local database)

I don't know much about LEDs, and the logic of what you are saying is unclear, but LEDs should be connected via a current-limiting resistor, say 560 ohm or 1k. The Blink example shows how they are switched, using digitalWrite. If you want to read the state of the pin to which the LED is connected, I guess you can use digitalRead but the LED is then redundant.