简体   繁体   中英

array_push using multidimensional array in ZEND Framework

I have a hierarchy like parent->child1->child2... and so on

And the main thing in this, developing of an array is only one's while insert/editing (I am working on zend).

Now, I want prevent updating my parent_id while in edit case of child .

I have used this, but its not working well

$data = array('fieldname'=>$request['name'],
              'fieldname2'=>$request['xyz']
);

if(!isset(update)){    
  array_push($data,'parent_id'=>$request['parent_id']);
}

You can't use array_push() in this context.

Just do this

if(!isset(update)){    
  $data['parent_id']=$request['parent_id'];
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM