The first thing you can learn HTML, whether you want to become a professional web developer or just want to learn more about how websites work. The basic language for developing web pages and web applications is HTML. A server ...
Asynchronous Javascript One of AJAX’s benefits is it provides instantaneous feedback to the user because it requests information asynchronously from the backend web server. However, using AJAX does not guarantee the user will not wait for the asynchronous JavaScript and ...
How To Make Cookie Free Domain An HTTP cookie (also known as a web cookie, Internet cookie, browser cookie, or simply cookie) is a small piece of data sent from a website and stored on the user’s computer by the ...
COM port handling via PHP
thank you all
thank you all
See lessCOM port data into mysql
thank you all for your support…
thank you all for your support…
See lessCOM port data into mysql
please explain little bit more… coming data would contain different id and date each time..
please explain little bit more… coming data would contain different id and date each time..
See lessCOM port handling via PHP
its always goes to else part record not inserted and value not inserting in database… Here is my config.php…. <?php $username = 'root'; $password = 'root'; $hostname = ''; $db = 'demo'; //connection to the database $dbhandle = mysql_connect($hosRead more
its always goes to else part record not inserted and value not inserting in database…
Here is my config.php….
<?php
$username = 'root';
$password = 'root';
$hostname = '';
$db = 'demo';
//connection to the database
$dbhandle = mysql_connect($hostname, $username)
or die ("Could not connect to server … \n" . mysql_error ());
//echo "Connected to MySQL”;
mysql_select_db($db)
or die (”Could not connect to database … \n” . mysql_error ());
NOw here is my php page with insert query …
<?php
$device = "COM6";
exec("mode $device BAUD=9600 PARITY=n DATA=8 STOP=1 ");
$comport = fopen($device, "r+w");
if ($comport === false){
die("Failed opening com port”);
}else{
//echo ”connected”;
while (!feof($comport)) {
sleep(3);
// echo fgets($comport);
$buffer = fgets($comport);
echo ”Read: $buffer”;
sleep(3);
}
}
include(’config.php’);
See lessif(isset($_POST[’buffer’])){
$buffer = $_POST[’buffer’];
$sql=(”INSERT INTO read (id,reading) VALUES (’’,’”.$buffer.”’)”)or die(mysql_error());
if (!mysql_query($sql,$dbhandle))
{
die(’Error: ’ . mysql_error());
}
echo ”1 record added”;
}
else{
echo”not inserted”;
}
fclose($comport);
?>
COM port handling via PHP
thanks for your quick response…. here is my code… <?php $device = "COM6"; exec("mode $device BAUD=9600 PARITY=n DATA=8 STOP=1 "); $comport = fopen($device, "r+w"); if ($comport === false){ die("Failed opening com port”); }else{ //echo ”coRead more
thanks for your quick response…. here is my code…
<?php
$device = "COM6";
exec("mode $device BAUD=9600 PARITY=n DATA=8 STOP=1 ");
$comport = fopen($device, "r+w");
if ($comport === false){
die("Failed opening com port”);
}else{
//echo ”connected”;
while (!feof($comport)) {
sleep(3);
// echo fgets($comport);
$buffer = fgets($comport);
echo ”Read: $buffer”;
sleep(3);
}
}
include(’config_port.php’);
if(isset($_POST[’buffer’]))
{
$sql=”INSERT INTO read (id,reading)
VALUES
(’’,’$_POST[buffer]’)”
or die(mysql_error());
}
else
{
echo ’Please select email address’;
}
fclose($comport);
?>
please do correct …
See less