我的記錄是:如果場==否則返回null顯示不
mysqli_select_db($KCC, $database_KCC);
$query_rsOtherServices = "SELECT pagecontent.mainMenuID, mainmenu.mainMenuLabel, pagecontent.subMenuID, submenu.subMenuLabel, pagecontent.contentID, pagecontent.contentTitle FROM submenu RIGHT JOIN (mainmenu RIGHT JOIN pagecontent ON mainmenu.mainMenuID = pagecontent.mainMenuID) ON submenu.subMenuID = pagecontent.subMenuID WHERE pagecontent.mainMenuID = 1 AND pagecontent.subMenuID IS NULL";
$rsOtherServices = mysqli_query($KCC, $query_rsOtherServices) or die(mysqli_error());
$row_rsOtherServices = mysqli_fetch_assoc($rsOtherServices);
$totalRows_rsOtherServices = mysqli_num_rows($rsOtherServices);
和我使用的顯示記錄的代碼是:
<?php do { ?>
<li><a href="familyservices.php?idVal=<?php echo $row_rsOtherServices['contentID']; ?>"><h4><?php echo $row_rsOtherServices['contentTitle']; ?></h4></a></li>
<?php } while ($row_rsOtherServices = mysqli_fetch_assoc($rsOtherServices)); ?>
如果這一切工作正常記錄存在,但如果沒有記錄,即使不可見,也可以點擊「鏈接」。
我試過<?php if ($totalRows_rsOtherServices['subMenuID'] === Null) { ?>
,<?php if ($totalRows_rsOtherServices['subMenuID'] > 0) { ?>
,<?php if ($totalRows_rsOtherServices['subMenuID'] == true) { ?>
,<?php if ($totalRows_rsOtherServices['subMenuID'] == false) { ?>
,但無濟於事。
我對編程一無所知,甚至對PHP的瞭解甚少,所以我甚至不確定我是否會朝着正確的方向前進。
我需要擺脫'隱形鏈接'。
正確。也許加入'foreach'看起來如何的代碼。 – trincot
對不起,但我認爲只有正確的一個,試試吧。 –
如果我使用它,即使有要顯示的記錄,它也不會顯示任何內容。事實上,由於最後一行中的' } ?>',我得到一個錯誤。如果我將其更改爲'',則會刪除錯誤。 – MartySmartyPants