write to database

Hi

I have made a weather station that collects all data to SD memory card and store it. I like to take the programming a bir further, so I have made a database to store the data. he reason is to make a homepage that access the data when I like.

On the server I have made a PHP script that stores the incoming data to my SQL database.

Everything with the script and database is working fine.

When i type: http://temperatur.co.nf/post.php?out_humid=2&out_temp=2&out_pressure=2 In the browser the database gets the numbers "2" in the correct places.

I like the Arduino script to write the data to my server the same way, but I cannot manage.

Without al the data collections, my program like like this:

char server[] = "temperatur.co.nf"; // Server we want to connect to EthernetClient client;

{

if (client.connect(server, 80))

{ Serial.println("Connected to server, updating temperatures.."); client.print("GET http://temperatur.co.nf/post.php?out_humid=1"); client.print(h1); client.print("&out_temp="); client.print(t1); client.print("&out_pressure="); client.print(h2); client.print("&sup_humid="); client.print(t2); client.print("&sup_temp="); client.print(h3); client.print("&room_humid="); client.print(t3); client.print("&room_temp="); client.print(T); client.println(); }

else {

Serial.println("Connection to server failed"); } }

client.stop();

Can someone please help me with the script.

The only thing thats missing is to write to the PHP script.

Looks mostly ok, assuming that your ethernet setup is correct but I think you're missing an additional client.println(); at the end of your request - check the reference example. Also, this:

out_humid=1

seems to have a superfluous 1 at the end - not that that's likely to be a problem.

Finally, when posting code, please use code tags and please post all of it.

client.print("GET http://temperatur.co.nf/post.php?out_humid=1");

The script to execute is NOT http://temperatur.co.nf/post.php. It is post.php.

It amazes me that you would name a script that expects GET variables post.

You should look at the HTTP 1.0 specification to see how to generate a valid HTTP request - in particular the headers must be followed by two CR/LF sequences. You may want to specify other header lines than just the GET, such as "Connection: close", you may want to experiment with your web server to see what it needs/likes.