Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: EthernetInterface TMP175 mbed-rtos mbed
Fork of HTTP_POST by
cgi-bin/restsql.txt
- Committer:
- stefan1691
- Date:
- 2015-06-09
- Revision:
- 10:3a38ba20cb57
- Parent:
- 9:dffb514cde17
- Child:
- 14:a93858b247b9
File content as of revision 10:3a38ba20cb57:
#!/bin/bash # # Mittels HTTP POST in MySQL Schreiben # HTTP Header fuer Client echo "Content-type: text/plain" echo "" # ### POST # if [ "$REQUEST_METHOD" = "POST" ] then # Zerlegt den Querystring in Einzelteile saveIFS=$IFS IFS='=&' parm=(`cat -`) IFS=$saveIFS printf "write to SQL Database: " FIELDS="" DATA="" for (( index = 0; index < ${#parm[@]}; index += 2 )) do if [ ${index} -gt 0 ] then FIELDS=${FIELDS}"," DATA=${DATA}"," fi FIELDS=${FIELDS}${parm[index]} DATA=${DATA}${parm[index+1]} done SQL="INSERT INTO data( ${FIELDS} ) VALUES( ${DATA} );" echo $SQL mysql -uwww-data -pmbed sensoren <<EOF ${SQL} EOF fi