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
Diff: cgi-bin/restsql.txt
- Revision:
- 14:a93858b247b9
- Parent:
- 10:3a38ba20cb57
--- a/cgi-bin/restsql.txt Fri Apr 15 14:28:39 2016 +0000 +++ b/cgi-bin/restsql.txt Fri Apr 15 18:14:33 2016 +0000 @@ -1,11 +1,26 @@ #!/bin/bash # # Mittels HTTP POST in MySQL Schreiben - + # HTTP Header fuer Client echo "Content-type: text/plain" echo "" - + +# +### GET +# +if [ "$REQUEST_METHOD" = "GET" ] +then + export SQL="SELECT * FROM data;" + + echo "$SQL" + echo "" + mysql -uwww-data -pmbed sensoren <<EOF + ${SQL} +EOF + +fi + # ### POST # @@ -16,7 +31,7 @@ IFS='=&' parm=(`cat -`) IFS=$saveIFS - + printf "write to SQL Database: " FIELDS="" DATA="" @@ -35,5 +50,5 @@ mysql -uwww-data -pmbed sensoren <<EOF ${SQL} EOF - + fi