1

当值传递给它时,我的 php 返回 null 我使用 chrome 的插件 POSTMAN 检查它...我无法找出问题:\ 这是我的代码,我试图通过从我的 android 代码发送值来更新数据库(没关系):-

<?php


$response = array();

// check for required fields
if (isset($_POST['id']) && isset($_POST['company']) && isset($_POST['date']) && 
isset($_POST['time']) && isset($_POST['ten']) && isset($_POST['twelve']) &&    
isset($_POST['aggregate']) && isset($_POST['backlog']) && isset($_POST['pending']) &&        
isset($_POST['branch'])) {
$cid = $_POST['id'];
$company = $_POST['company'];
$date = $_POST['date'];
$time = $_POST['time'];
$ten = $_POST['ten'];
$twelve = $_POST['twelve'];
$aggregate = $_POST['aggregate'];
$backlog = $_POST['backlog'];
$pending = $_POST['pending'];
$branch = $_POST['branch'];

// include db connect class
require_once __DIR__ . '/db_connect.php';

// connecting to db
$db = new DB_CONNECT();

// mysql update row with matched pid
$result = mysql_query("UPDATE companies SET company = '$company', date = '$date', time  
= '$time' ten = '$ten', twelve = '$twelve',aggregate = '$aggregate', backlog = 
'$backlog', pending = '$pending', branch = '$branch'  WHERE id = $cid");

// check if row inserted or not
if ($result) {
// successfully updated
$response["success"] = 1;
$response["message"] = "Company successfully updated.";

// echoing JSON response
echo json_encode($response);
} else {

}
} else {
// required field is missing
$response["success"] = 0;
$response["message"] = "Required field(s) is missing";

// echoing JSON response
echo json_encode($response);
}
?>
4

1 回答 1

3

你错过了一个逗号:

= '$time', ten = '$ten', twelve = '$twelve', aggregate = '$aggregate', backlog = 
     ____^_____
于 2013-08-16T20:11:41.950 回答