我的记录是:如果场==否则返回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