Go Down

Topic: ARDUINO + PHP (Read 1 time) previous topic - next topic



I m sending two values (heart rate and temperature) database into Apache Server like:

float temperature = 30.8;
float heart = 120;

client.println("get /arduino.php?temp=temperature&hr=heart");

And the values aren't sent. but like this i can but i want to send variable values:

client.println("get /arduino.php?temp=30.8&hr=120");

Help me thanks


Jun 17, 2013, 12:35 pm Last Edit: Jun 17, 2013, 12:36 pm by _hg_ Reason: 1
For reference, split it between multiple print strings and terminate that sequence with a println.
To answer this question:
Code: [Select]

client.print("get /arduino.php?temp="); //print the constant string
client.print(temperature); //print the variable temperature's value, note the lack of quotation marks
client.print("&hr="); //print the constant string
client.println(heart); //finally send the variable heart's value and a newline, in order to submit the data

The OP's problem was that they were sending the request as a constant string, so what the server was getting was "get /arduino.php?temp=temperature&hr=heart"
Correct me if I'm wrong.

Use common sense when writing code. Some functions work similarly across libraries.


I know I'm being picky here but shouldn't heart rate be an 8-bit int rather than a float? Resolution of 0.1bpm seems unnecessary and if it goes above 255 an alarm rather than a precise reading ought to suffice  ;) Same goes for values below zero.

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131