我很困惑为什么我的 php mysql 函数不能在远程服务器上运行,而它在我的本地主机上运行良好。
<?php
function getAllMachines(){
if(!isset($_GET['cat'])){
global $db_con;
$getmachine_qry = "SELECT * FROM MACHINES";
$run_getmachine_qry = mysqli_query($db_con, $getmachine_qry);
while($row_getmachine = mysqli_fetch_array($run_getmachine_qry)){
$machine_ID = $row_getmachine['id'];
$machine_cat = $row_getmachine['fk_cat_id'];
$machine_title = $row_getmachine['machine_title'];
$machine_year = $row_getmachine['year'];
$machine_image = $row_getmachine['mac_image'];
$machine_price = $row_getmachine['price'];
$getCats_qry = "SELECT * FROM categories where id=$machine_cat";
$run_getCats = mysqli_query($db_con, $getCats_qry);
while($row_getCats = mysqli_fetch_array($run_getCats)){
$cat_title = $row_getCats['cat_title'];
}
echo "<div class='clearfix' style='float: left; margin: 20px; padding: 10px; box-shadow: 0px 0px 4px 2px rgba(0,0,0,0.4);'>"
. "<a href='detail.php?mac_id=$machine_ID'><img class='img-thumbnail' src='images/$machine_title/$machine_image' width='250px' /></a>"
. "<h4><b>$machine_title</b></h4>"
. "<h5 class='text-danger'>$cat_title</h5>"
. "<p style='float:left;'>Year: <b class='text-warning'>$machine_year</b></p><br />"
. "<h4 class='bg-success text-white'><b>£ $machine_price</b></h4>"
. "</div>";
}
}
}
?>