我已经用PHP编写了代码,但无法从代码中获得响应。以下是我的代码。
<?php
include_once("conectionFile.php");
$db = new Data();
$con = $db->Conn();
$val = $_REQUEST;
$lclQuery = "SELECT * FROM student_details WHERE st_id = ".$val."";
$lclResult = $con->query($lclQuery);
if($row = $lclResult->fetchAll(PDO::FETCH_ASSOC)) {
echo $res = json_encode($row);
}
?>
答案 0 :(得分:0)
$lclQuery = "SELECT * FROM student_details WHERE st_id = ".$val."";
您需要更改查询,因为它也不正确,而且$ val是数组,因此您需要在此处使用正确的键以获取值,例如$val = $_REQUEST['some_id']
然后更改查询,例如
$lclQuery = "SELECT * FROM student_details WHERE st_id = '".$val."'";