本文主要是介绍Web_PHP_DedeCMS_{dede:php}标签嵌套查询使用;,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
{dede:php} // 第一次查询$fsql = 'SELECT a.id,a.title,a.litpic,d.expert,d.introduction FROM dede_archives as a,dede_addondisease as d WHERE a.id = d.aid GROUP BY d.expert ORDER BY a.pubdate DESC LIMIT 3'; $db->Execute('first', $fsql); while($farr = $db->GetArray('first')) { $expert = $farr["expert"];$title = $farr["title"];$introduction = mb_substr($farr["introduction"],0,20,'gbk');echo '<li>'; echo ' <span><a href="/plus/view.php?aid='.$farr["id"].'"><img src="'.$farr["litpic"].'" width="90" height="75" /></a></span>'; echo ' <h4><a class="blue" href="/plus/view.php?aid='.$farr["id"].'" style="line-height:18px;">'.$title.'</a></h4>'; echo ' <p>'.$expert.'</p>'; echo ' <p>'.$introduction.'...<a href="/plus/view.php?aid='.$farr["id"].'" class="red" target="_blank">[查看详细]</a></p>'; // 第二次查询(嵌套)$ssql = 'SELECT a.id,a.title FROM dede_archives as a,dede_addondisease as d WHERE a.id = d.aid and d.expert = "'.$expert.'" and a.title != "'.$title.'" ORDER BY a.pubdate DESC LIMIT 2';$db->Execute('second', $ssql);while($sarr = $db->GetArray('second')) {echo '<a class="blue" style="line-height:18px;" href="/plus/view.php?aid='.$sarr["id"].'" >'.$sarr["title"].'</a><br />';}echo '</li>'; }{/dede:php}
这篇关于Web_PHP_DedeCMS_{dede:php}标签嵌套查询使用;的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!