Re: usar array_walk en una clase

From: Date: Fri, 28 Sep 2007 09:37:06 +0000
Subject: Re: usar array_walk en una clase
References: 1 2  Groups: php.general.es 
Request: Send a blank email to general-es+get-61486@lists.php.net to get a copy of this message
Gracias Samuel! efectivamente tenia que usar array_walk($datos,array($this, 'setUpdate')); On 9/27/07, Samuel Castillo <scastillo@hostalia.com> wrote: > > Prueba array_walk($datos,array($this, 'setUpdate')); > > > Gerardo Benitez wrote: > > Hola gente, alguno sabe como usar la funcion array_walk dentro de una > clase? > > > > estoy teniendo el problema que al llamarla me dice que no puede llamar a > la > > funcion que quiero que aplique al array. > > > > este es el codigo que tengo > > > > function actualizarDb($datos){ > > $sql = "update estructura_costos set "; > > array_walk($datos,'$this->setUpdate'); //EL ERROR ME LO MARCA > ACA > > // array_walk() > > > > [function.array-walk<http://localhost/initium/function.array-walk>]: > > Unable to call $this->setUpdate() - function does not exist in > > > > $sql .= implode(",",array_values($datos)); > > $sql .= " where id_estructura='$id' "; > > echo $sql; > > exit(); > > mysql_query($sql) or die(mysql_error()); > > } > > > > function setUpdate(&$item, $key){ > > $item .= $key."=".$item; > > } > > > > > > > > -- Gerardo Benitez ---------------------------------------------------------------------- mercadoagil.com.ar webseficientes.com.ar tips y articulos para desarrolladores web ----------------------------------------------------------------------

« previous php.general.es (#61486) next »