getRow($sql); */ $dbinfo['host'] = '192.168.0.143'; $dbinfo['user'] = 'gaogongDB'; $dbinfo['pswd'] = 'gaogong*E23d'; $dbinfo['name'] = 'gaogong_hy'; $db = new DataBase($dbinfo); $sql="select c.category_name,s.name,s.intro,s.site_url,s.logo,s.category_id from forum_sponsor_category c inner join forum_sponsor s on c.id=s.category_id where s.forum_id=106"; $res_zz=$db->getRow($sql);//���������� $res_zz = gbkToUtf8($res_zz); $sql =" select sc.id,sc.category_name from forum_sponsor_category sc inner join forum_sponsor ss on sc.id=ss.category_id where ss.forum_id=106 group by sc.id order by ss.sort desc"; $res_sort=$db->getRow($sql);//���������� $res_sort = gbkToUtf8($res_sort); $all =array(); foreach( $res_sort as $k=>$v){ foreach( $res_zz as $k1=>$v1){ if( $v[id]==$v1[category_id]){ $all[$v[category_name]][]=$v1; } } } // print_r($sql); // print_r($all); // exit; $smarty->assign("all",$all);//�ֺ������������Ϣ //$smarty->assign("hy_news",$res); $smarty->display("2018fenghui/index.html"); function gbkToUtf8($result){ if(count($result)>0){ for($i=0;$i$value){ $result[$i][$key] =mb_convert_encoding($result[$i][$key],'UTF8','GBK'); } } } return $result; }