Location of add_data.php


hi,

hopefully simple fix i'm pretty sure i'm 99% there.

i've been trying set simple "read temperature data , record on mysql database" style project. i've been following tutorial here:

http://www.tweaking4all.com/hardware/arduino/arduino-ethernet-data-push/

all seems working fine in terms of connecting database etc, reason no additions being made mysql table.

my php files fine believe, if write manual "add_data.php?serial=xxxxxxxx...." etc string browser can see record appear in mysql table.

my arduino code follows:

code: [select]
#include <uipethernet.h> // used ethernet

// **** ethernet setting ****
// arduino uno pins: 10 = cs, 11 = mosi, 12 = miso, 13 = sck
// ethernet mac address - must unique on network - mac reads t4a001 in hex (unique in network)
byte mac[] = { 0x54, 0x34, 0x41, 0x30, 0x30, 0x31 };                                       
// rest use dhcp (ip address , such)

ethernetclient client;
char server[] = "audiovisualelectroni.ipagemysql.com"; // ip adres (or name) of server dump data to
int  interval = 5000; // wait between dumps

void setup() {

  serial.begin(9600);
  ethernet.begin(mac);

  serial.println("tweaking4all.com - temperature drone - v2.0");
  serial.println("-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n");
  serial.print("ip address        : ");
  serial.println(ethernet.localip());
  serial.print("subnet mask       : ");
  serial.println(ethernet.subnetmask());
  serial.print("default gateway ip: ");
  serial.println(ethernet.gatewayip());
  serial.print("dns server ip     : ");
  serial.println(ethernet.dnsserverip());
}

void loop() {
  // if connection, report via serial:
  if (client.connect(server, 80)) {
    serial.println("-> connected");
    // make http request:
    client.print( "get /add_data.php?");
    client.print("serial=");
    client.print( "288884820500006x" );
    client.print("&&");
    client.print("temperature=");
    client.print( "12.3" );
    client.println( " http/1.1");
    client.print( "host: " );
    client.println(server);
    client.println( "connection: close" );
    client.println();
    client.println();
    client.stop();
   
   
    serial.println( "get /add_data.php?");
    serial.println("serial=");
    serial.println( "288884820500006x" );
    serial.println("&&");
    serial.println("temperature=");
    serial.println( "12.3" );
    serial.println( " http/1.1");
    serial.println( "host: " );
    serial.println(server);
    serial.println( "connection: close" );
    serial.println();
    serial.println();
    client.stop();
   
  }
  else {
    // didn't connection server:
    serial.println("--> connection failed/n");
  }

  delay(interval);
}


i've modified standard code having issues, added in serial.println lines see if debug. has shown me connection being made server can see "connected" appear in serial monitor.

but - think reason no records being added because of following line, in can't find "add_data.php" file on webspace.

i have put add_data.php file root of webspace no avail.

is able please?

for reference, example add-data command below (copy , paste browser):

http://aveshop.co.uk/add_data.php?serial=123456789012345a

and once added, added data can seen at:

http://aveshop.co.uk/review_data.php

thanks in advance!!!   :d  ;)

your code says:
code: [select]

char server[] = "audiovisualelectroni.ipagemysql.com";


is correct?


Arduino Forum > Topics > Home Automation and Networked Objects > Location of add_data.php


arduino

Comments