Point Taken. Thank You for your offer. Here then is everything... Here is the sketch
#include <SPI.h>
#include <Ethernet.h>
#include <DHT.h>
#define DHTPIN 37 // what pin we're connected to
#define DHTTYPE DHT11 // DHT 11
DHT dht(DHTPIN, DHTTYPE);
#include <NewPing.h>
#define TRIGGER_PIN 35 // Arduino pin tied to trigger pin on the ultrasonic sensor.
#define ECHO_PIN 33 // Arduino pin tied to echo pin on the ultrasonic sensor.
#define MAX_DISTANCE 200 // Maximum distance we want to ping for (in centimeters). Maximum sensor distance is rated at 400-500cm.
NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE); // NewPing setup of pins and maximum distance.
const int ledPin = 8;
int ledState = LOW;
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; // this must be unique
IPAddress gateway(192, 168, 209, 1);
IPAddress subnet(255, 255, 255, 0);
IPAddress server(xxx,xxx,xxx,xxx); // "myserver.com"
//Change to your domain name for virtual servers
char serverName[] = "myserver.com";
int serverPort = 80;
int inData[16]; // Allocate some space for the Bytes
byte index = 0; // Index into array; where to store the Bytes
EthernetClient client;
char pageAdd[128];
#define delayMillis 120000UL // 2 minute delay
unsigned long thisMillis = 0;
unsigned long lastMillis = 0;
void setup() {
Serial.begin(9600);
pinMode(ledPin, OUTPUT);
dht.begin();
// disable SD SPI
pinMode(4,OUTPUT);
digitalWrite(4,HIGH);
// Start ethernet
Serial.println(F("Starting ethernet..."));
// Ethernet.begin(mac, ip, gateway, gateway, subnet);
// If using dhcp, comment out the line above
// and uncomment the next 2 lines
if(!Ethernet.begin(mac)) Serial.println(F("failed"));
else Serial.println(F("ok"));
digitalWrite(10,HIGH);
Serial.println(Ethernet.localIP());
delay(2000);
Serial.println(F("Ready"));
}
void loop()
{
thisMillis = millis();
if(thisMillis - lastMillis > delayMillis)
{
lastMillis = thisMillis;
unsigned int uS = sonar.ping(); // Send ping, get ping time in microseconds (uS).
int volt1 = digitalRead(31);
int volt2 = analogRead(12);
volt2 = (volt2 / 68.12 ,1);
int humid1 = dht.readHumidity();
int level1 = (uS / US_ROUNDTRIP_CM);
int temp1 = dht.readTemperature();
int spare2 = digitalRead (38);
if (ledState == LOW)
ledState = HIGH;
else
ledState = LOW;
// set the LED with the ledState of the variable:
digitalWrite(ledPin, ledState);
sprintf(pageAdd,"/Firstdata2.php?temp1=%d&level1=%d&volt1=%d&volt2=%d&humid1=%d&spare2=%d",temp1,level1,volt1,volt2,humid1,spare2);
if(!getPage(server,serverPort,pageAdd)) Serial.print(F("Fail "));
else Serial.print(F("Pass "));
}
}
byte getPage(IPAddress ipBuf,int thisPort, char *page)
{
int inChar;
char outBuf[128];
Serial.print(F("connecting..."));
if(client.connect(ipBuf,thisPort))
{
Serial.println(F("connected"));
sprintf(outBuf,"GET %s HTTP/1.0",page);
client.println(outBuf);
sprintf(outBuf,"Host: %s",serverName);
client.println(outBuf);
client.println(F("Connection: close\r\n"));
}
else
{
Serial.println(F("failed"));
return 0;
}
// connectLoop controls the hardware fail timeout
int connectLoop = 0;
while(client.connected())
{
while(client.available())
{
inChar = client.read();
inData[index] = inChar; // Store it
index++;
// Serial.write(inChar);
// set connectLoop to zero if a packet arrives
connectLoop = 0;
}
Serial.print(inChar);
connectLoop++;
// if more than 10000 milliseconds since the last packet
if(connectLoop > 10000)
{
// then close the connection from this end.
Serial.println();
Serial.println(F("Timeout"));
client.stop();
}
// this is a delay for the connectLoop timing
delay(1);
}
Serial.println();
Serial.println(F("disconnecting."));
// close client end
client.stop();
return 1;
}
This is Output from Serial Monitor
Starting ethernet...
ok
192.168.0.177
Ready
connecting...connected
20483204832048320483204832048320483204832048320483.....
And here is the php code as it currently sits
xxx,1,0,1,0,1
<?
$temp1 = $_GET['temp1'];
$level1 = $_GET['level1'];
$volt1 = $_GET ['volt1'];
$volt2 = $_GET ['volt2'];
$humid1 = $_GET ['humid1'];
$spare2 = $_GET ['spare2'];
$dbcnx = mysql_connect("localhost","xxxxxx","xxxxxxxx");
if(!$dbcnx)
{
echo( "<P>Unable to connect to the database server at this time.</P></body></html>" );
exit();
}
if(!mysql_select_db("xxxxxxxxxxxx") )
{
echo( "<P>Unable to locate the test database at this time.</P></body></html>" );
exit();
}
$result = mysql_query("INSERT INTO Table1 ( Temp1,Level1,Volt1,Volt2,Humid1,Spare2 ) VALUES ('$temp1', '$level1', '$volt1', '$volt2', '$humid1', '$spare2' )");
if(!$result) echo("<P>Insert failed</P>");
else echo("Insert Ok: ");
mysql_close($dbcnx);
echo('Temp1=' . $temp1 . ', ');
echo('Level1=' . $level1 . ', ');
echo('Volt1=' . $volt1 . ', ');
echo('Volt2=' . $volt2 . ', ');
echo('Humid1=' . $humid1 . ', ');
echo('Spare2=' . $spare2 . '. ');
?>
This is where I am now.