title: Last insert id return error in Yii
body: <p>I just executed some code in controller, and try to find the last inserted id.</p>
  
  <p>But it display s error :</p>
  
  <p>This is my code:</p>
  
  <pre><code>$sql = 'INSERT into "Tbl_Community" ("User_id","Community_name") VALUES (10,'new community')';
  $connection = Yii::app() -&gt; db;
  $command = $connection -&gt; createCommand($sql);
  $command -&gt; execute();
  echo $connection-&gt;getLastInsertID();
  </code></pre>
  
  <p>The error:</p>
  
  <pre><code>[message:protected] =&gt; SQLSTATE[42602]: Invalid name: 7 ERROR:  invalid name syntax
      [string:Exception:private] =&gt; 
      [code:protected] =&gt; 42602
      [file:protected] =&gt; D:\wamp\www\Tiein\framework\db\CDbConnection.php
      [line:protected] =&gt; 548
      [trace:Exception:private] =&gt; Array
          (
              [0] =&gt; Array
                  (
                      [file] =&gt; D:\wamp\www\Tiein\framework\db\CDbConnection.php
                      [line] =&gt; 548
                      [function] =&gt; lastInsertId
                      [class] =&gt; PDO
                      [type] =&gt; -&gt;
                      [args] =&gt; Array
                          (
                              [0] =&gt; 
                          )
  
                  )
  </code></pre>