的財產我想下面的代碼獲取有關試圖讓非對象
<?php
$lat = "27.7350758";
$long = "85.3102946";
$result = $conn->query('SELECT * , (3956 * 2 * ASIN(SQRT(POWER(SIN(($lat - college_lat) * pi()/180/2), 2) +COS($lat * pi()/180) * COS(college_lat * pi()/180) * POWER(SIN(($long - college_lon) * pi()/180/2), 2)))) as distance from colleges having distance <= 10 order by distance');
if ($result->num_rows>0) {
// output data of each row
while($row = $result->fetch_assoc()) {
echo '<div class="category"><div class="cover" style="background-image: url(img/animation.jpg);"><div>'; ?>
<td><?php echo $row[ "college_name" ]; ?></td>
<?php
echo '</div></div><span class="counter ">Courses : <span>' . $row[ "college_courses" ] . '</span></span>';
echo '<span class="counter "> Distance : <span>' . $row[ "college_address" ] . '</span></span>';
echo '<span class="near-you"> <p>'. substr($row[ "college_desc" ], 0 , 100) . '</p> </span></div>'; ?>
<a href="single.php?college_id=<?php echo $row['college_id'];?>"> Read More... </a>
<?php
}
} else {
echo "Colleges Not Found Please add";
}
?>
當我運行這段代碼在我身邊,顯示最近的位置下面的錯誤將顯示
通知錯誤:試圖讓非對象的屬性在C:\ XAMPP \ htdocs中\上線大學\的index.php 56所 院校未找到,請添加
如果我刪除$ lat和$ long,然後保持查詢的效果。 我的錯誤請給我建議。謝謝
嘗試過但錯誤相同 –