How to write in a database with wireless communication and with photon

You are going to need something in between the data coming off of the Photon and the database. There are a couple options that you have here. (You can’t really just write code on the Photon that interacts directly with the database.)

  1. Have the particle photon communicate directly with the server by sending data to the server that is then stored in the database. (In my opinion, the most modular and therefore the best option.)
    For this reference the http code MORA’s post above. Also, you will need a basic understanding of POST, GET, PUT, etc. in PHP:
    Here are links for that:
    https://www.youtube.com/watch?v=CEl3bhCBjtI

To elaborate further on this option, you need to be able to access your WAMP server from the web.
So, you need to open the ports on your firewall on port 80 if running locally, or you could also push your WAMP stuff to another service that hosts your application publicly. Once you have that set, you should be able to go to your website such as www.mysite.com (or perhaps just an ip address if there is no domain). If you do not want to do this portion, you can probably find the local ip address of the computer running the server and use that instead!

Then on the code behind mysite.com you need to code a page such as photon.php that can handle a request from the photon.

So when you POST data to photon.php at www.mysite.php/photon.php there will be php code to take the data coming off of the sensor and then store it in the database via a mysql insertion through php.

This is a lot of different abstract concepts in one place, so if you have any questions just reach out.

  1. Have code on the server that reaches out to the Photon by retrieving the data you have published using the particle.
    Something like this:
    phpSpark - interacting with the Spark Cloud (spark.io) using PHP