所以,我想访问我的数据库,为此,我正在从AJAX调用一个PHP页面,该页面应该仅返回来自DB的查询结果,而是返回全文存在于其中。 请帮忙。提前谢谢。
这是我的代码:
的Ajax:
<?php
$con = mysqli_connect('localhost','root','root');
if (!$con) {
die('Could not connect: ' . mysqli_error($con));
}
mysqli_select_db($con,"springhibernate");
$project = $_GET['project'];
$project = mysql_real_escape_string($project);
$query = "SELECT employee FROM project WHERE projectname = '".$project."'";
$qry_result = mysqli_query($con,$query) or die(mysql_error());
$result = "";
while($row = mysqli_fetch_array($qry_result)) {
$result .= "<option>".$row['employee']."</option>";
}
echo $result;
mysqli_close($con);
exit();
?>
myajax.php:
{
//
protected $table = "pendaftar";
public $timestamps = false; //it should be false
protected $fillable=['tgl','nopol','motor','servis','keluhan'];
}
我已经在某处读过PHP应该只返回&#34; Echo&#34;部分。我也看到很多例子都会被跟踪。