Skip to content

Instantly share code, notes, and snippets.

@jackkitley
Created March 6, 2013 08:18
Show Gist options
  • Save jackkitley/5097592 to your computer and use it in GitHub Desktop.
Save jackkitley/5097592 to your computer and use it in GitHub Desktop.
What am i doing wrong?
if(!empty($_POST)) {
$datenow = new CDbExpression('NOW()');
$systemaccountmodel->attributes=array('datecreated'=>$datenow,'createdbyuserid'=>0);
$systemaccountmodel->save();
$systemaccountid = Yii::app()->db->getLastInsertId();
$_POST["Person"][1]['systemaccountid'] = $systemaccountid;
$_POST["Person"][1]['datecreated'] = $datenow;
$_POST["Person"][1]['createdbyuserid'] = 0;
$personaldetailsmodel->attributes=$_POST["Person"][1];
$personaldetailsmodel->save();
var_dump($_POST);
}
@DarkMukke
Copy link

              if(!empty($_POST)) {
        $datenow = new CDbExpression('NOW()');

        $systemaccountmodel->attributes=array('datecreated'=>$datenow,'createdbyuserid'=>0);
        $systemaccountmodel->save();
        $systemaccountid = Yii::app()->db->getLastInsertId();

                    $personaldetailsmodel->attributes=$_POST["Person"][1];
        $personaldetailsmodel->systemaccountid = $systemaccountid;
        $personaldetailsmodel->datecreated = $datenow;
        $personaldetailsmodel->createdbyuserid = 0;

        $personaldetailsmodel->save();

        var_dump($_POST);
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment