我的查询没有返回任何值。
$minprice = itemDetails("SELECT MIN(extra_night) FROM hotel_room WHERE hotel_id ='".$row[hotel_id]."'");
以下是我的网站
https://www.borneoecotours.com/hotels/index--.php
<?php
//$sql_query = $querystring;
$j=0;
if(mysqli_num_rows(mysqli_query($dbhandler,$querystring)) > 0){ //if there is a record
$sql_result = mysqli_query($dbhandler,$querystring)or die(mysqli_error());
while($row = mysqli_fetch_array($sql_result)){
echo '<div class="summbox">';
echo '<div class="summheader">';
echo '<div class="summtitle"><a href="view.php?id='.$row[hotel_id].'" class="hotlink">'.$row[code].' : '.stripslashes($row[name]).' ';
for ($x=1; $x<=$row[star]; $x++){echo "<span class='icon-star blue'></span>";}
echo '</a></div>';
echo '<div class="summduration">'.$row[location].', '.ucwords($row[region]).'</div>';
echo '</div>';
echo '<br clear="right" />';
echo '<div class="summcenter">';
if ($row[pic]==""){
echo '<div class="summpic"><img src="image/'.$row[hotel_id].'/profile.jpg" width="200" height="150" /></div>';
}else{
echo '<div class="summpic"><img src="../image/tours/'.$row[pic].'" width="200" height="150" /></div>';
}
echo '<div class="summdetails">'.stripslashes($row[brief]).'</div>';
$minprice = itemDetails("SELECT MIN(extra_night) FROM hotel_room WHERE hotel_id ='".$row[hotel_id]."'");
echo '<div class="summprice" style="width:250px;">RATES FROM <br />MYR <span style="font-size:20px;">'.$minprice.'</span></div>';
echo '<br clear="right" />';
echo '<div class="summfooter">';
echo '<a href="view.php?id='.$row[hotel_id].'" class="button small blue">Details</a> '; //details
if ($row[hotel_id] != '17')
echo '<a href="form.php?id='.$row[hotel_id].'" class="button small red">Book Now</a>'; //enquiry
else
echo '<a href="http://www.borneobackpackers.com/reservation.php" class="button small red">Book Now</a>'; //enquiry
//echo '<a href="#"><div class="summbutton_03"></div></a>'; //booknow
echo '</div>';
echo '</div>';
echo '</div>';
echo '<div class="clear">';
}
} else{
echo '<div class="alert-msg error">No record. Please search again.</div>';
}
?>
假设$ minprice将从我的数据库返回值。任何的想法? 输出应显示MYR(数据库中的值),例如:MYR 1200
function itemDetails($query){
$sql_query = mysql_query($query);
$item = mysql_fetch_array($sql_query);
return stripslashes($item[0]);
}