tkbyd:
Dear XL97...
I've seen most of the steps you so clearly identified written up many times... but not the bit about ...
Any good web pages on that out there? (Forgive me... my Google button broke earlier... but also I wouldn't know good advice from bad.)
Or can you post some approximate code for us to work from?
I can send a "thing" to an Arduino webserver, to, say, get it to turn an LED connected to the server on or off. I presume that to insert a record in a WAMP MySQL database (under my direct control) it is sort of similar? Just "ask the server" for a page of .php?
That is correct.
Just call up the .php script and it will execute/do what its coded for.
In the link I posted in my reply to you.. there is a complete working example.
Including database set-up, insert and query (request) example .ph scripts..
as well as insert and query (request) .ino example files..
I posted some code/examples here:
Using MySQLConnector with Ethenet Shield 2 - #27 by xl97 - Project Guidance - Arduino Forum
Meat & potatoes of the post:
If you do want to learn how to make an Arduino send some data to a PHP script that is logged to a database, I have some example of code to:
set up an example database with a few test fields (columns)
2 php scripts (although with little effort could be combined into one I suppose) that handle saving data received from an Arduino to a database and also retrieve requested data/values from a database (MySQL)
and some example sketches that you can use for sending/saving data to a DB and requesting data from a DB, and you can test/run this all from a (free) local install of WAMP Server.
this is more or less a generic starting point... you will need to edit some things, like:
IP address for your network/ip range
right now there is now parsing of the returned data/response.. just outputs it all to serial monitor, so if you are expecting a 1 to turn on the led/pin..etc.. you need to add that portion to handle the data response as you see fit.
Package contains:
1 x db set-up script
2 x php files for saving send data and retrieving requested data (values)
2 x arduino sketches for sending/saving data and requesting data
All files:
http://dmstudios.net/misc/Arduino_Save_Retrieve_Database/Arduino_Save_Retrieve_Database.zip
MySQL table setup:
http://dmstudios.net/misc/Arduino_Save_Retrieve_Database/database_setup.txt
Insert Data PHP: (rename to .php instead of .txt)
http://dmstudios.net/misc/Arduino_Save_Retrieve_Database/insert_data2.txt
Retrieve Data PHP: (rename to .php instead of .txt)
http://dmstudios.net/misc/Arduino_Save_Retrieve_Database/get_data2.txt
Send/Log Data Sketch:
http://dmstudios.net/misc/Arduino_Save_Retrieve_Database/WAMP_server_logging_v1.ino
Request/Retrieve Data Sketch:
http://dmstudios.net/misc/Arduino_Save_Retrieve_Database/WAMP_server_requesting_v1.ino
The general concept is:
Saving/Logging Data:
-
Arduino requests specific .php script (see sketch and matching .php file)
-
Each 'adruino' has a device name (ie: LR_temp1 = living room temp 1 sensor for example) (which is sent over via query string parameter)
-
Each 'submission' (logging) of data checks to see if 'device name' is in the database.. if not, it makes a new entry with this device's IP address, timestamp, device name, and (sensor) value it needs to save/log. It the device name -is- already in the database, then it just updates that record with the new value (and ip and updated timestamp)
-
logging/saving doesnt have to be done through an arduino..
Requesting/Retrieving Data:
- Arduino requests specific .php script (see sketch and matching .php file)
- Arduino sends along its device name and list of query parameters WITHOUT values as its list of requested data.
- PHP script checks database for device name.. if found it will loop through all query params (which should match the database columns you want data from) and get the matching data for the device name.
so if you just want to see what is in column/field value1... then you just send over the device name and value1.. if you also want the timestamp it was updated.. then you can add time_stamp to query params..
All files could be cleaned up a bit from commented out code.. and notes..
As always if there is a better way to accomplish this, I'm open for discussion. Not saying anything I do is the best way, just that is works for me. 
On a side note.. I just set up a Raspberry Pi 3, as a webserver (LAMP w/phpMyAdmin), along with an MQTT broker/server
There is even a quick and easy PHP class that lets you talk to an MQTT broker from a .php script!
This is perfect for a 'networked' example of what you want to do...
RFID card is read, transaction is logged/booked in a database, and you can then send an MQTT update (message) to all subscribed devices on the network.
(imagine you scan RFID card, and 5 ESP8266 wi-fi modules light up at same time, alerting whomever that the RFID card was scanned....etc..etc.. or whatever actions you want)