我正在尝试使用此链接向web_service发送数据。
http://localhost/FixItApp/admin.php?serial_number=mmm&items=asd&brand=qwe&price=sd&user_name=vfd
但是数据没有发布,无法想象为什么。 这是我的web_service。
<?php
$myfile = fopen("newfile.txt", "w") or die("Unable to open file!");
$txt = "not set";
if(isset($_REQUEST))
{
$txt = serialize($_REQUEST);
}
fwrite($myfile, $txt);
fclose($myfile);
require_once "DatabaseConnection.php";
$result = null;
if ($_GET)
{
/* User table attribute */
$serial = filter_input(INPUT_GET, "serial_number", FILTER_SANITIZE_STRING);
$item = filter_input(INPUT_GET, "items", FILTER_SANITIZE_STRING);
$item_brand = filter_input(INPUT_GET, "brand", FILTER_SANITIZE_STRING);
$item_price = filter_input(INPUT_GET, "price", FILTER_SANITIZE_STRING);
$name = filter_input(INPUT_GET, "user_name", FILTER_SANITIZE_STRING);
if(is_null($serial))
{
echo "Null Values";
}
else
{
$select_ExistUser = @"SELECT serial_number from admin WHERE serial_number = '$serial'";
$resultUser = selectQuery($select_ExistUser);
if(count($resultUser)==0)
{
$query_one = "INSERT INTO admin(serial_number, items, brand, price, user_name)
VALUES('$serial', '$item', '$item_brand', $item_price, '$name')";
$result = insertQuery($query_one);
$insert_id = $db->insert_id;
if($insert_id)
{
echo "Great";
}
}
else
{
echo "ResultUser > 0";
}
}
}
if ($result)
{
$arr= [
"result" => $insert_id,
"status_message" => "Good",
"status_code" => 1
];
}
else
{
$arr = [
"result" => $result,
"status_message" => "Sorry!",
"status_code" => -1
];
}
echo json_encode($arr);
答案 0 :(得分:2)
price = sd ???
将其更改为...
price = anyInteger;