<?php
$sql=$empire->query("select * from {$dbtbpre}ecms_jf where jinyi !='' and fanyi !='' order by onclick limit 40");
while($r=$empire->fetch($sql)){
?>
<li><a href="<?=$r[titleurl]?>"><span>[近反义词]</span><?=$r[title]?></a></li>
<?}?>

释:

where jinyi !=” and fanyi !=”

jinyi不等于空 并且  fanyi不等于空

== 等于

!= 不等于

 

附怎么输出所属的栏目名跟栏目地址呢?以下实例:

<?php  
$class_arr = [];  
$class_sql = $empire->query("select classid, classname, classpath from {$dbtbpre}enewsclass");  
while ($class_row = $empire->fetch($class_sql)) {  
    $class_arr[$class_row['classid']] = $class_row;  
}  

$sql = $empire->query("select * from {$dbtbpre}ecms_soft order by newstime DESC limit 8");  
while ($r = $empire->fetch($sql)) {  
?> 

<span class="four">
<a href="/<?= $class_arr[$r['classid']]['classpath'] ?>/"><?= $class_arr[$r['classid']]['classname'] ?></a>
</span>

<?}?>

 

声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。