I have created a command which access a table named tbl_temp_above_100 but while executing command it shows error no such table exist. I am 100% sure that table exist and their is no spelling or upper/lower case mistake. Why it is happening?
class SenditCommand extends CConsoleCommand
{
public function getHelp()
{
echo "";
}
public function actionIndex()
{
$connection=Yii::app()->db;
$sql="SELECT id, temperature FROM tbl_temp_above_100 WHERE done = 0" ;
$dataReader=$connection->createCommand($sql)->queryAll();
while($dataReader->read()!==false)
{
foreach($dataReader as $row)
{
$messageBody = '';
$mailling = new SendMail;
$subject = 'high temp';
var_dump($row);
//$messageBody = $row['id'] . $row['temperature'];
}
}
}
}
and I am executing command as yiic sendit index.