MySQL Forums
Forum List  »  Connector/Arduino

Re: editing database data from arduino
Posted by: Charles Bell
Date: February 18, 2015 12:13PM

Hi. Allow me to give you an example.

char buf[128];
int count;

// Open serial communications and wait for port to open:
Serial.begin(115200);
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
Serial.println("Hello. Demo string replacement.");
count = 125;
sprintf(buf, "UPDATE test_arduino.variable SET 'test' ='%d' WHERE inventory_id ='5'", count);
Serial.println(buf);

Output:

Hello. Demo string replacement.
UPDATE test_arduino.variable SET 'test' ='125' WHERE inventory_id ='5'


You can also examine the Strings-StringReplace example sketch for more clues.

Options: ReplyQuote


Subject
Views
Written By
Posted
1832
February 11, 2015 11:58PM
1087
February 12, 2015 10:35PM
Re: editing database data from arduino
952
February 18, 2015 12:13PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.