(deleted)
I don't like using the String data type, but if you must, then this should work. I haven't tested it, so no guarantee.
int x = 4;
char tBuffer[48];
sprintf(tBuffer,"SELECT * FROM sensors WHERE id = %d",x);
String result = mysql_result_query(tBuffer , "value");
edit: I don't know about that "value" parameter. I don't think you need that.
I followed the same tutorial and I can't get it to work. Maybe the library is outdated?
Everytime I try to upload his code I get
/Users/mycomputer/Documents/Arduino/libraries/mysql/mysql.cpp: In function 'int mysql_connect(char*, char*, char*, char*)':
/Users/mycomputer/Documents/Arduino/libraries/mysql/mysql.cpp:31:5: error: redefinition of 'int mysql_connect(char*, char*, char*, char*)'
int mysql_connect(char *host, char *user, char *pass, char *db){
^
/Users/mycomputer/Documents/Arduino/libraries/mysql/mysql.cpp:10:5: error: 'int mysql_connect(char*, char*, char*, char*)' previously defined here
int mysql_connect(char *host, char *user, char *pass, char *db){
^
/Users/mycomputer/Documents/Arduino/libraries/mysql/mysql.cpp: In function 'String mysql_result_query(String, String)':
/Users/mycomputer/Documents/Arduino/libraries/mysql/mysql.cpp:67:10: error: converting to 'String' from initializer list would use explicit constructor 'String::String(int, unsigned char)'
return 0;
^
/Users/mycomputer/Documents/Arduino/libraries/mysql/mysql.cpp:71:10: error: converting to 'String' from initializer list would use explicit constructor 'String::String(int, unsigned char)'
return 0;
^
Error compiling.
Maybe the library is outdated?
You misspelled crap. There is no excuse for a library to be using the String class.
D:\Installed\Arduino\libraries\mysql\mysql.cpp: In function 'int mysql_connect(char*, char*, char*, char*)':
D:\Installed\Arduino\libraries\mysql\mysql.cpp:31:5: error: redefinition of 'int mysql_connect(char*, char*, char*, char*)'
int mysql_connect(char *host, char *user, char *pass, char *db){
^
D:\Installed\Arduino\libraries\mysql\mysql.cpp:10:5: note: 'int mysql_connect(char*, char*, char*, char*)' previously defined here
int mysql_connect(char *host, char *user, char *pass, char *db){
^
exit status 1
Error compiling for board Arduino/Genuino Uno.
I get this error/problem i don't know what to do please help me I can't connect to wamp server
I get this error/problem i don't know what to do please help me I can't connect to wamp server
Start using punctuation.
STOP using that stupid library!
What do you mean by punctuation?? and what do i need to do to connect to either wamp or xampp?
Hey did you get the solution to the error , even I am facing the same error
Porwal_muskan:
Hey did you get the solution to the error , even I am facing the same error
It is pointless to post this, without posting your code, and a description of your specific problem. If you are trying to work with a MySQL database, on a server that you own, don't use the connector library. Create PHP scripts and make GET requests to execute those scripts.