0
votes

I had tried following thing.

 <?php
        $servername = "127.0.0.1:3307"; //localhost
        $username = "root";
        $password = "";

            // Create connection
            $conn = new mysqli($servername, $username, $password);

                try {
                        $conn = new PDO("mysql:host=$servername;dbname=test", $username,$password);
                            // set the PDO error mode to exception

                            echo "Connected successfully"; 

                            $sql = "INSERT INTO test.senrdata (temp) VALUES (".$_GET["value"].")"; 
                            echo "query " . $sql ;  
                            $conn->exec($sql);

                            // Execute SQL statement
                    }
    ?>

I had tried Arduino code which gives sensor data and store this data on server.

1

1 Answers

0
votes

I found solution as follows:

Requirement:

1.Visual studio

2.Arduino

3.Sql server

Steps to follow:

1.Connect your arduino kit to PC via USB cable.

2.Update driver for COM Port on PC.(This PC->Manage->Device Manager->Ports(COM and LPT))

3.Create Windows console application which listen on Same COM port as Arduino is Listening and store data in database (SQL server).

4.Create WEB application which reads this data and display values.