Question

 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;
       }
Was it helpful?

Solution

try this code.

echo "select * from tbl_sensor where stype=4 and nid=$nid order by timestamp desc limit 10";
$res= Yii::app()->db->createCommand("select * from tbl_sensor where stype=4 and nid=$nid order by timestamp desc limit 10")->queryAll();

//print_r($res); // will return array of result.
// to check query, print the query executed.

return $res;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top