Thank euromake I used cake core function to solve this problem instead of foreach(){} CakePHH core function: Set::extract
On Feb 16, 12:04 am, euromark <dereurom...@googlemail.com> wrote: > you can always use foreach(){} - basic PHP one-o-one > > On 15 Feb., 14:08, diendannhatban <lecaoquoch...@gmail.com> wrote: > > > > > > > > > Hello, > > > I would like to join data to string before write to DB. Anyone help > > me solve this out please. Thank you! > > > The data from form will look like this > > [Event] => Array > > ( > > [mark] => Array > > ( > > [0] => 1 > > [1] => 2 > > [2] => 3 > > [3] => 4 > > ) > > ) > > > The following code will join the data to "1,2,3,4" string before > > writing it to the db > > // join type into csv > > if(!empty($this->data['Event']['mark'])) { > > $this->data['Event']['mark'] = join(',', > > $this->data['Event'] > > ['mark']); > > } > > > *My Problem: > > The form data of mine after editing for a good view it will return > > like this. > > I would like to join the value to the string like the code about. How > > would I solve the problem? > > > [Schedule] => Array > > ( > > [1] => Array > > ( > > [mark] => 1 > > ) > > > [2] => Array > > ( > > [mark] => 2 > > ) > > > [3] => Array > > ( > > [mark] => 3 > > ) > > > [4] => Array > > ( > > [mark] => 4 > > ) > > > ) -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php