hello,
Iam having two tables inbox(inbox_id,from,to,subject,content)
,sentitems(sentitem_id,from,to,subject,content).
when i submitted the data should store in both inbox and sentitems.
hello,
Iam having two tables inbox(inbox_id,from,to,subject,content)
,sentitems(sentitem_id,from,to,subject,content).
when i submitted the data should store in both inbox and sentitems.
Try the following code:
$model2=new sentitems; //create another objetc of your second class
if(isset($_POST[‘inbox’])){
$model->attributes=$_POST['inbox'];
$model2->setAttribute('column_name', $_POST['inbox']['from']);
if($model->save()){
$model2->save();
}
Hit like if my solutions are helping you out.
Hello,
S@ndy iam using yii 2.0. so please tell how we can use query builder to insert values in two tables.