MySQL Forums :: Connector/Arduino :: editing database data from arduino

Advanced Search

Re: editing database data from arduino
Posted by: Jimmy T ()
Date: February 12, 2015 10:35PM

ok so i got the arduino to update the server using the mysql update command (imagine that) but it only works with non variables.... how do i use variables?

here is the dht22 example that works....
sprintf(buf, "INSERT INTO test_arduino.temp_humida VALUES (NULL,%hi.%01hi,%i.%01i)",

i have no idea what this part of the code means (NULL,%hi.%01hi,%i.%01i), obviously the NULL is to skip the column id... the % stuff... how did you come up with that nameing? im assuming that the mydht below are the variables.... the syntax makes no sense to me. anyone care to explain?

also once that is done how would i apply the same concept to the update command?
const char INSERT_DATA[] = "UPDATE test_arduino.variable SET 'test' ='50' WHERE id ='5'";
i would like 50 to be where the variable goes (wouldnt hurt to learn how to make id a variable either)

ive tried variations of this to no avail
char buf[128];
sprintf(buf, "UPDATE test_arduino.variable SET 'test' ='.%\count' WHERE inventory_id ='5'", count);

thanks, hopefully i figure it out tomorrow, any help is appreciated, if not hope this helps someone down the line

Options: ReplyQuote

Subject Views Written By Posted
editing database data from arduino 1704 Jimmy T 02/11/2015 11:58PM
Re: editing database data from arduino 1022 Jimmy T 02/12/2015 10:35PM
Re: editing database data from arduino 911 Charles Bell 02/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.