Register here!

Forgot password?

ASK NEW QUESTION

Home Page » createCommand

Questions tagged as "createCommand"

0 Votes

createCommand() only can use one time?

createCommand

  1. $command=Yii::app()->db->createCommand();
  2. $result1=$command->select('test')->queryRow();
  3. $result2=$command->select('test2')->queryRow();
  4. $result3=$command->select('test3')->queryRow();
$command=Yii::app()->db->createCommand();
$result1=$command->select('test')->queryRow();
$result2=$command->select('test2')->queryRow();
$result3=$command->select('test3')->queryRow();

the $result1,$result2,$result3 all the same as $result1, why the $command only use one time?I need to write code as below:

  1. $command1=Yii::app()->db->createCommand();
  2. $command2=Yii::app()->db->createCommand();
  3. $command3=Yii::app()->db->createCommand();
  4. $result1=$command1->select('test')->queryRow();
  5. $result2=$command2->select('test2')->queryRow();
  6. $result3=$command3->select('test3')->queryRow();
$command1=Yii::app()->db->createCommand();
$command2=Yii::app()->db->createCommand();
$command3=Yii::app()->db->createCommand();
$result1=$command1->select('test')->queryRow();
$result2=$command2->select('test2')->queryRow();
$result3=$command3->select('test3')->queryRow();

I think thisREAD MORE

By kcloze in DAO · Asked 599 days 22 hours 24 mins ago

Questions: 1 Accepted: 0 ( 0% ) | Reputation: 0

© YiiAnswers.com 2011. All rights reserved.

Switch to our mobile site