I want to connect an arduino with a Mysql database created by php.
There will be several arduinos all over the country.
These arduino's should log their data once a month.
The database should be hosted in internet.
Data is a count taken by number of times that a button has been pressed.
So my question is what can I use to send this data to database?
Links to tutorials/Videos will be useful.
(If it is nodemcu how can I use it? I don't understand it. Does it need a wifi module or it has one onboard?What is the data flow of it?)
NodeMCU has WiFi built in, and makes it very easy to log data to a remote server. Send it out as http POST query, or use the MySQL Connector library to connect directly to your MySQL database.
This makes no sense: "The database should be hosted in internet."
You need to have a dedicated website/IP/database where this data is to be logged..
What is your solution to that? Almost any hosting packages comes with PHPMyAdmin, MySQL and support PHP5 (maybe 7 by now)..
After that point you need to create a PHP script that is ready to accept/parse your incoming data to be logged.
(PHP will grab data and also do the work of inserting it into the database you set up)
You can use an Ethernet shield (requires a CAT5/6 LAN cable to be present/accesible)..
You can use an ESP8266 modulesor choice
Or you can use one the ESP development/breakout board like mentioned above (NodeMCU.....Wemos..etc)
If you search here.. I have posted several 'solution's that include files for creating the database, PHP scripts for selecting and inserting data into a database, as well as the Arduino sketch/code)
If you go with one of the ESP8266 modules or a ESP development board.. you might not even need the Arduino at all.. (as the ESP modules can also act like Arduinos more or less, but with the added benefit of having wifi)
You can start development by using WAMP/XAMP as a local install on your PC... Then move to have an on-line database be accessible once testing is complete.