提问人:Samantha Kyle Apostol 提问时间:11/13/2023 最后编辑:ADysonSamantha Kyle Apostol 更新时间:11/13/2023 访问量:37
为什么我的 ajax 不能从数据库中获取数据?[关闭]
Why can't my ajax fetch data from the database? [closed]
问:
当我输入 SYMPTOMS 而不是得到 Illness 时,它会显示 else 语句
<?php
$conn = mysqli_connect("localhost" , "root" , "" , "symptoms");
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
$getMesg = mysqli_real_escape_string($conn, $_POST['text']);
$check_data = "SELECT * FROM diagnose2 WHERE Symptoms LIKE '%diagnose2%'";
$run_query = mysqli_query($conn, $check_data) or die("Error");
if(mysqli_num_rows($run_query) > 0){
$fetch_data = mysqli_fetch_assoc($run_query);
$replay = $fetch_data['Illness'];
echo $replay;
}else{
echo "Sorry can't be able to understand you!";
}
$conn->close();
?>
而不是 Sorry can't able to understand you!,显示 Illness
答: 暂无答案
评论
%diagnose2%
%$getMesg%
$getMesg