PHP LOAD DATA LOCAL INFILE Realtime Update MySQL -


good evening,

i having problems trying achieve in php/mysql.

i have text file (in real time) taking 1 row of numbers i.e. 1.43 etc sensor on com port. information needs sent mysql pretty in real time.

as test have used text document without real time using php load data local infile seems sending data mysql database.

my question is, how send data 1 second, next second send latest information not on mysql database, otherwise have loads of duplicate data?

my current code follows:

<?php $username = "root"; $password = ""; $hostname = "localhost";  // connect database , table  $dbhandle = mysql_connect($hostname, $username, $password)     or die("unable connect mysql"); echo "connected mysql<br>";  $selectdatabase = mysql_select_db("data",$dbhandle)     or die("could not select iwemsdata"); echo "connected iwemsdata<br>";  // text file read in  $textfile = 'data.txt';  mysql_query('load data local infile "data.txt" replace table received_data fields terminated "," lines terminated "\\r\\n";')     or die('error loading data file.<br>' . mysql_error());  // close database connection when complete  mysql_close($dbhandle); ?> 

i have taken on php / mysql booklet

any appreciated prevent me pulling hair out!


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

javascript - addthis share facebook and google+ url -

ios - Show keyboard with UITextField in the input accessory view -