我将用户当前的纬度和经度保存为变量$latitude
和$longitude
. 如果纬度和经度与用户当前的纬度和经度匹配,我只希望数据库中的数据回显。
$con=mysqli_connect("localhost","db_username","password","db_dbname");
$stmt = $con->prepare('SELECT * FROM test WHERE geoloc1 = ? and geoloc2 = ?');
$stmt->bind_param('ss', $latitude, $longitude);
$stmt->execute();
$result = $stmt->get_result();
while ($row = $result->fetch_assoc()) {
?>
<div class="latlon">
<a><?php echo $row['geoloc1'] ?></a>
</div>
<?php
}
?>
但是我得到了错误Fatal error: Call to undefined method mysqli_stmt::get_result()
,我似乎无法解决它为什么会出现!