日期:2014-05-17 浏览次数:20991 次
$sql="select title from a"
........
while($tpl2result=mysql_fetch_array($result_sql))
{
if(sizeof($array1)<5)
{
if($this->guolv($tpl2result['title']))
array_push($array1,$tpl2result);
}
if(sizeof($array2)<5)
{
if(!$this->guolv($tpl2result['title']))
array_push($array2,$tpl2result);
}
if(sizeof($newtalk)==5&&sizeof($newvote)==5)
{
break;
exit;
}
}
$array1 = array();
$SQL = "SELECT a.title As atitle FROM a WHERE a.title in(SELECT b.title FROM b)";
$mysql->query($SQL);
$total = 0;
while ($result = $mysql->fetch_assoc()) {
$array[] = $result['atitle'];
if ($total > 5) {
break;
}
$total++;
}
$array2 = array();
$SQL = "SELECT a.title As atitle FROM a WHERE a.title not in(SELECT b.title FROM b)";
$total = 0;
while ($result = $mysql->fetch_assoc()) {
$array2[] = $result['atitle'];
if ($total > 5) {
break;
}
$total++;
}
------解决方案--------------------