samedi 18 juin 2016

Not able to insert the data from url to database in php

final.php

Here I am trying to get the data from the url using GET method and trying to insert into the database. I was able to insert the data for first few rows after that the data is not inserted. Can anyone help me regarding this?

when I try to run the url: www.myii.com/app/final.php?name=123&glucose=3232... the data is not inserting.

 <?php 
include("query_connect.php");

$name = $_GET['name'];
$glucose = $_GET['glucose'];
$temp = $_GET['temp'];

$battery = $_GET['battery'];
$tgs_a = $_GET['tgs_a'];
$tgs_g = $_GET['tgs_g'];
$heartrate = $_GET['heartrate'];
$spo2 = $_GET['spo2'];
$rr = $_GET['rr'];
$hb = $_GET['hb'];
$ina22 = $_GET['ina22'];
$accucheck = $_GET['accucheck'];
$isactive = $_GET['isactive'];
$address = $_GET['address'];
$deviceno = $_GET['deviceno'];

$sql_insert = "insert into query (name,glucose,temp,battery,tgs_a,tgs_g,heartrate,spo2,rr,hb,ina22,accucheck,isactive,address,deviceno) values ('$name','$glucose','$temp',$battery','$tgs_a','$tgs_g','$heartrate','$spo2','$rr','$hb','$ina22','$accucheck','$isactive','$address','$deviceno')";

mysqli_query($sql_insert);

if($sql_insert)
{
    echo "Saving succeed";
    //echo $date_time;
}
else{
    echo "Error occured";
}

?>

Query_connect.php

This is my database config php file.

    <?php 
$user = "miiroot";
$password = "mi434";
$host = "localhost";

$connection = mysqli_connect($host,$user,$password);
$select = mysqli_select_db('miiyy',$connection);

if($connection)
{
    echo "connection succesfull<br>";
}
else {
    echo "Error";
}

?>

Aucun commentaire:

Enregistrer un commentaire