我是 php 编程的新手。我确实创建了简单的代码来保存数据,我使用 JSON 从 android 应用程序获取数据,但是当我测试我的 php 代码时出现这样的错误
解析错误:语法错误,第 12 行 E:\Ampps\www\koneksi\insert_data.php 中的意外 T_ISSET
我的代码
<?php
/*
* Following code will create a new product row
* All product details are read from HTTP Post Request
*/
// array for JSON response
$response = array();
// check for required fields
if (isset($_POST['jenis_kendaraan']) && isset($_POST['jenis_pelanggaran']) && isset($_POST['wilayah_hukum']) isset($_POST['barang_sitaan']) && isset($_POST['email']) && isset($_POST['hp']) && isset($_POST['lokasi_sidang']) && isset($_POST['barang_sitaan_lain'])) {
$jenis_kendaraan = $_POST['jenis_kendaraan'];
$jenisPelanggaran = $_POST['jenis_pelanggaran'];
$barang_sitaan = $_POST['barang_sitaan'];
$email = $_POST['email'];
$hp = $_POST['hp'];
$lokasi_sidang = $_POST['lokasi_sidang'];
$barang_sitaan_lain = $_POST['barang_sitaan_lain'];
// include db connect class
require_once __DIR__ . '/db_connect.php';
// connecting to db
$db = new DB_CONNECT();
// mysql inserting a new row
$result = mysql_query("INSERT INTO products(jenisKendaraan, jenisPelanggaran, wilayahHukum, barangSitaan, email, hp, lokasiSidang, barangSitaanLain) VALUES('$jenis_kendaraan', '$jenis_pelanggaran', '$wilayah_hukum','$barang_sitaan', '$email', '$hp', '$lokasi_sidang', '$barang_sitaan_lain')");
// check if row inserted or not
if ($result) {
// successfully inserted into database
$response["success"] = 1;
$response["message"] = "Product successfully created.";
// echoing JSON response
echo json_encode($response);
} else {
// failed to insert row
$response["success"] = 0;
$response["message"] = "Oops! An error occurred.";
// echoing JSON response
echo json_encode($response);
}
} else {
// required field is missing
$response["success"] = 0;
$response["message"] = "Required field(s) is missing";
// echoing JSON response
echo json_encode($response);
}
?>
这是第12行硬币
if (isset($_POST['jenis_kendaraan']) && isset($_POST['jenis_pelanggaran']) && isset($_POST['wilayah_hukum']) isset($_POST['barang_sitaan']) && isset($_POST['email']) && isset($_POST['hp']) && isset($_POST['lokasi_sidang']) && isset($_POST['barang_sitaan_lain']))
需要你们的帮助,很抱歉英语不好