Register here!

Forgot password?

ASK NEW QUESTION

Home Page » DAO
0 Votes

Yii Dynamic DB Connection according to user?

yiiyii dynamic connection

My project is on the basis of multi-talent.

I have multiple clients (companies) and each client has multiple users.

Each client has their own database, so during user authentication, I discover theREAD MORE

By gaurishpatil · Asked 398 days 21 hours 50 mins ago

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

0 Votes

Create a complex dataprovider for a DataPicker

cactivedataproviderCDbCriteriaCGridViewData Pickerdataprovider

I am trying to implement the datapicker in a student update form. Following are the models I want to use in this form:

  1. Student
  2. 'internshipHasStudent' => array(self::HAS_ONE, 'InternshipHasStudent', 'student_id'),
  3. 'interests' => array(self::MANY_MANY, 'Interest', 'student_has_interest(student_id, interest_id)'),
  4. 'internship' => array(self::HAS_ONE, 'Internship', 'internship_id', 'through' => 'internshipHasStudent')
  5.  
  6. Internship
  7. 'students' => array(self::HAS_MANY, 'Student', 'student_id', 'through' => 'internship_has_student'),
  8. 'interests' => array(self::MANY_MANY, 'Interest', 'internship_has_interest(internship_id, interest_id)'),
  9. 'internshipHasStudents' => array(self::HAS_MANY, 'InternshipHasStudent', 'internship_id'),
  10. 'organization' => array(self::HAS_ONE, 'Organization', 'organization_id', 'through' => 'contact'),
  11. 'contact' => array(self::BELONGS_TO, 'Contact', 'contact_id'),
Student
'internshipHasStudent' => array(self::HAS_ONE, 'InternshipHasStudent', 'student_id'),
'interests'READ MORE

By giunz · Asked 490 days 1 hour 33 mins ago

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

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 · Asked 600 days 3 hours 21 mins ago

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

0 Votes
Solved!

How to increment col, using query builder?

commandquery builder

I want to do this command:

  1. UPDATE {{myTable}} SET counter = counter + 1 WHERE id=23
UPDATE {{myTable}} SET counter = counter + 1 WHERE id=23

How to do it with query builder?

http://www.yiiframework.com/doc/guide/1.1/en/database.query-builder

READ MORE

By dckur · Asked 602 days 3 hours 49 mins ago

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

© YiiAnswers.com 2011. All rights reserved.

Switch to our mobile site