1

I am new with YII framework so, sorry for my beginner level.

I want to know how to insert a SQL request inside this framework ?

Like

SELECT *
FROM tab_a as a, tab_b as b
WHERE a.id=b.id 
0

1 Answer 1

1

Try this -

$connection = Yii::app()->db;
$command = $connection->createCommand("SLECT * FROM tab_a as a, tab_b as b WHERE a.id=b.id");
$row = $command->queryRow();
Sign up to request clarification or add additional context in comments.

2 Comments

Sorry I use this inside the controler code or view code ?
You can use inside the controller if you want to render the records otherwise use in view.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.