Test Mysql

Dependencies:   mbed MySQLClient EthernetNetIf

Files at this revision

API Documentation at this revision

Comitter:
yonaetworks
Date:
Wed Jul 21 06:01:15 2021 +0000
Parent:
2:2711bbad1623
Commit message:
a

Changed in this revision

MySQLClientExample.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 2711bbad1623 -r ab8a9d84da07 MySQLClientExample.cpp
--- a/MySQLClientExample.cpp	Fri Jul 09 14:49:01 2010 +0000
+++ b/MySQLClientExample.cpp	Wed Jul 21 06:01:15 2021 +0000
@@ -2,10 +2,10 @@
 #include "EthernetNetIf.h"
 #include "MySQLClient.h"
 
-#define SQL_SERVER   ""
-#define SQL_USER     ""
-#define SQL_PASSWORD ""
-#define SQL_DB       ""
+#define SQL_SERVER   "192.168.100.204"
+#define SQL_USER     "mysql"
+#define SQL_PASSWORD "mysql"
+#define SQL_DB       "petey"
 
 EthernetNetIf eth; 
 MySQLClient sql;
@@ -45,8 +45,11 @@
   //SQL Command
   //Make command
   char cmd[128] = {0};
-  const char* msg="Hello World!";
-  sprintf(cmd, "INSERT INTO Test (Test) VALUES('%s')", msg);
+  const char* msg="1";
+  const char* msg2="69.78";
+  const char* msg3="70.90";
+  const char* msg4="TRIP-A";
+  sprintf(cmd, "INSERT INTO location (idlocation, lati, long, tripid) VALUES('%s')", msg,msg2,msg3,msg4);
   
   //INSERT INTO DB
   string cmdStr = string(cmd);