Yii Framework Forum: Yii Database - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Yii Database findbysql Rate Topic: -----

#1 User is offline   sanjeev4cs 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 23-November 13

Posted 03 March 2014 - 04:09 AM

hi , i am not able to get last 10 element in yii , using findby sql

down vote favorite


public function getGet($nid)
{
$sensor = $this->findBySql("select * from tbl_sensor where stype=4 and nid=$nid order by timestamp desc limit 10;");

if ($sensor == NULL)
return "NULL";
return $sensor->sdata;
}
0

#2 User is offline   nineinchnick 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 622
  • Joined: 12-September 11
  • Location:Bialystok, Poland

Posted 03 March 2014 - 03:34 PM

Use findAllBySql instead of findBySql.
Don't be a dick.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users