final.php
这里我试图使用GET方法从URL获取数据并尝试插入数据库。在未插入数据之后,我能够插入前几行的数据。任何人都可以帮我解决这个问题吗?
当我尝试运行网址时:www.myii.com/app/final.php?name=123&glucose=3232...
数据没有插入。
<?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";
}
&GT;
Query_connect.php
这是我的数据库配置php文件。
<?php
$user = "m33root";
$password = "me3i434";
$host = "localhost";
$connection = mysqli_connect($host,$user,$password);
$select = mysqli_select_db('miiyy',$connection);
if($connection)
{
echo "connection succesfull<br>";
}
else {
echo "Error";
}
&GT;
答案 0 :(得分:1)
确保所有列都包含NULL,以便未填充的字段保持为NULL而不是抛出错误。
答案 1 :(得分:0)
试试这些
在SQL中
query
到其他名称。 Cz query是
在SQL中保留代码
if (!mysqli_query($con,$sql_insert ))
{
echo("Error description: " . mysqli_error($con));
}
else
{
echo "Success";
}
答案 2 :(得分:0)
请尝试以下方法查看mysql错误:
mysql_query($sql_insert);
echo mysql_error()