Thursday, 12 February 2015

Simple way to insert or update mysql tables in YII using php

 $connection1=Yii::app()->db;  // Gets the application connection
     
       $sql1="update inw_trans set out_section='$sname',out_time='$tdt',remarks='$rem' where id=$max";
       $command1=$connection1->createCommand($sql1)->execute();


Like wise the insert statements

$connection=Yii::app()->db;
      $sql="insert into inw_trans(inw_no,sec_code,sub_scode,in_time,status,in_section,ipadd) values ($inwno,$sec_code,$subsec,'$tdt','O','$sname','$ipadd')";
        $command=$connection->createCommand($sql)->execute();

No comments:

Post a Comment