Select In Yii

hi all ,i tried to get the result from the table MAIL using the below query ,but it gets displayed as a array ,how can i get it?

$connection=Yii::app()->db;

  $sql = "SELECT Receiver from mail";


  $command=$connection->createCommand($sql);


  print_r($command->queryRow());

use queryScalar() instead of queryRow()

Thank you :)

One more help,if i select * from mail what can i use instead queryScalar?

   $connection=Yii::app()->db;


  $sql = "SELECT * from mail";


  $command=$connection->createCommand($sql);


  print_r($command->queryScalar());

queryAll()

<?php

  echo'Only First Row'. &quot;&lt;/br&gt;&quot;;


  echo '-----------'. &quot;&lt;/br&gt;&quot;;


  &#036;connection=Yii::app()-&gt;db;


  &#036;sql = &quot;SELECT * from mail&quot;;


  &#036;command=&#036;connection-&gt;createCommand(&#036;sql);


  print_r(&#036;command-&gt;queryAll());


  echo &quot;&lt;/br&gt;&quot;;?&gt;

</p>

had tried this,but gets the result as

Array ( [0] => Array ( [E_Id] => xx@gmail.com [Receiver] => david) )

i need the values alone to be displayed,can u help????

Try this my fiend!




echo'Only First Row'. "</br>";

echo '-----------'. "</br>";

$connection=Yii::app()->db;

$sql = "SELECT * from mail";

$command=$connection->createCommand($sql);

foreach ($command->queryAll()as $value) {

echo $value['E_id'].' '.$value['Receiver'].'</br>';

}




Thanks a lot :D

that’s free! ;)