0
當我點擊API時,我以前動態獲取了結果。在此之前,我爲android創建了很多API,但我從來沒有像這樣面臨過問題。我被創建了一個API,從android獲取ID並將該ID的詳細信息發送給android
下面是代碼
<?php
error_reporting(0);
echo $empId = $_REQUEST['empId'];
date_default_timezone_set('Asia/Kolkata');
$datetime = date('Y-m-d H:i:s');
require_once "db.php";
$query = "SELECT `id`, `name`, `mobileNumber`, `tempMobileNumber`, `email`, `photo`, `supervisorId`, `emergencyMobileNumber`, `emergencyName`, `relation`, `address`, `designation`, `appId`, `qrCode`, `vendorId`, `siteName`, `latitude`, `langitude` FROM `tbl_employee` WHERE `appId`= $empId";
$result = mysqli_query($connect,$query);
echo $count = $result->num_rows;
if($count > 0)
{
$response["empDetails"] = array();
$row_user = $result->fetch_assoc();
$emp = array();
$emp["ID"] = $row_user["id"];
$emp["appId"] = $row_user["appId"];
$emp["name"] = $row_user["name"];
$emp["mobileNumber"] = $row_user["mobileNumber"];
$emp["tempMobileNumber"] = $row_user["tempMobileNumber"];
$emp["email"] = $row_user["email"];
array_push($response["empDetails"], $emp);
$response["success"] = 1;
$response["message"] = "Attendance Placed Successfully.";
echo json_encode($response);
}
else
{
echo "wrong";
}
?>
什麼是錯誤? – gaurav
$ result = mysqli_query($ connect,$ query);結果得不到正確 –
評論錯誤報告的行比看看你在代碼中得到了什麼錯誤 – gaurav