Hi, you can use the implode function, you have 2 options.

1. Modify app_model.php , the save() function:
Modify the line:        list($fields[], $values[]) = array($x, $y);

into


        function save($data = null, $validate = true, $fieldList = array()) {
                ....
                        foreach ($this->data as $n => $v) {
                              ....
                                    foreach ($v as $x => $y) {
                                                if ($this->hasField($x) && 
(empty($this->whitelist) ||
in_array($x, $this->whitelist))) {
                                                        if(!empty($y) && 
is_array($y)) {
                                                                list($fields[], 
$values[]) = array($x, implode(",",$y));
                                                        } else {
                                                                list($fields[], 
$values[]) = array($x, $y);
                                                        }

                        ....
      }

This will apply for all tables and all columns

2. Modify inside individual controller classes, specify which fields
need to apply the change:


<?php
class CatalogueMenusController extends AppController {

        var $multiples = array('fiedl1','field2);
       var $formName = "CatalogueMenu";

.....
        function edit($id = null) {
.....
                if (!empty($this->data)) {
                       foreach($this->multiples as $m) {
                          $this->data[$this->formName][$m] =
implode(",", $this->data[$this->formName][$m]);
                      }

                        if ($this->CatalogueMenu->save($this->data)) {
                         ...
                 }
}


On Feb 25, 4:11 am, autnoc <[email protected]> wrote:
> If I dump out the array, it returns the correct values within the
> array - just integers.
>
> Problem is, I don't know how to process the values of the array to
> pass into the update query.  So, if I have an array being generated
> that looks like Array (1,3,4), how do I insert it into the update
> query as UPDATE ... WHERE ... VALUES (id, '1,3,4') instead of ...
> VALUES (id, Array) which is being returned now.
>
> Sorry, if I'm being unclear here, I can answer any other specific
> questions if you have any.
> Thanks for the reply!
>

-- 
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
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to