2016年2月

织梦CMS中嵌套查询语句,SetQuery和GetObject传入不同的参数就可以了。

if($keyword != '')
{
	$query2 = "SELECT id,title,typeid FROM `#@__archives` where arcrank>-1 AND ($keyword) ORDER BY id desc limit 0,5";
}
else
{
	$query2 = "SELECT id,title,typeid FROM `#@__archives` where arcrank>-1 ORDER BY id desc limit 0,5";
}
$dsql->SetQuery($query2);
$dsql->Execute(1);
while($row=$dsql->GetObject(1))
{
	$dsql->SetQuery("Select typedir From `#@__arctype` where id='$row->typeid'");
	$dsql->Execute(2);
	$ttrow=$dsql->GetObject(2);
	$tpdir=substr($ttrow->typedir,10);
	$likearticle .= "
  • ".cut_str(ConvertStr($row->title),16)."
  • "; }