kongqingfu 2012-04-28 08:29:12 3216次浏览 0条回复 0 0 0

视图里:

public function searchbymatetop()
{
    // Warning: Please modify the following code to remove attributes that
    // should not be searched.
		
    $criteria=new CDbCriteria;
    $criteria->select='max(price) as price_top';
    $criteria->with=array('sup_name'=>array("select"=>"sup_name.name"),);
    $criteria->condition  = 'date = (
        SELECT max( date ) from
        think_pricechange
        WHERE supid = t.supid
        AND mateid = t.mateid )';
    $criteria->addcondition('mateid=:mateid');
    $criteria->params=array(':mateid'=>$this->id,);

		
    return  $this->findall($criteria);
					
}

动作:

$top_price=new Pricechange();
$top_price->unsetAttributes();  // clear any default values
$top_price->id=$_GET['id'];		

视图 <?php echo "最高价".$top_price->price_top.元; ?> 应该是怎样写呢?没有显示结果。还有视图可以修改一下吗?如何用self::stat

    没有找到数据。
您需要登录后才可以回复。登录 | 立即注册