Re: usar array_walk en una clase

From: Date: Thu, 27 Sep 2007 20:45:38 +0000
Subject: Re: usar array_walk en una clase
References: 1  Groups: php.general.es 
Request: Send a blank email to general-es+get-61472@lists.php.net to get a copy of this message
Gerardo Benitez schrieb: > 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; > } > > Hola Gerardo, lo que te esta diciendo es que la function $this->setUpdate() no existe. Saludos Carlos

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