good call Ill have to check out the library better.
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1185507207/51#51 I believe is the main thread. I think the guy that wrote it is an arduino hobbyest.
Just for further testing I have put a resistor between 3.3v and RST to stop the reset on serial open.
Im getting the same problems.
I thought maybe a dumb browser issue so I ran the code from command line and dumped results to DB.
I then added a dumb amount of sleeps in PHP with same issues.
<?php
$dbhost = 'localhost';
$dbuser = 'root';
$dbpass = 'asdf';
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');
$dbname = 'arduino';
mysql_select_db($dbname);
$sql="select * from levels";
$results= mysql_query($sql);
$row = mysql_fetch_array($results);
?>
<?php
/* Script for Checking all the levels*/
// Load the serial port class
require("php_serial.class.php");
//Initialize the class
$serial = new phpSerial();
//Specify the serial port to use... in this case COM1
$serial->deviceSet("/dev/ttyUSB0");
//Set the serial port parameters. The documentation says 9600 8-N-1, so
$serial->confBaudRate(9600); //Baud rate: 9600
$serial->confParity("none"); //Parity (this is the "N" in "8-N-1")
$serial->confCharacterLength(8); //Character length (this is the "8" in "8-N-1")
$serial->confStopBits(1); //Stop bits (this is the "1" in "8-N-1")
// Ask Arduino what the Air Temp is.
$serial->deviceOpen();
sleep(3); //wait for Arduino reset after serial open
$serial->sendMessage(chr(10)); // start transmission
$serial->sendMessage(chr(50));
$serial->sendMessage(chr(13)); // end transmission
sleep(3); //wait for Arduino reset after serial open
$read = $serial->readPort(); // waiting for reply
sleep(3); //wait for Arduino reset after serial open
$current_air_temp = $read;
$current_air_temp = (int)$current_air_temp;
//We're done, so close the serial port again
$serial->deviceClose();
mysql_query("INSERT INTO logging (stuff,Sensor) VALUES ($current_air_temp,'Air Temp')");
?>