Re: Re: usar array_walk en una clase
| From: | Samuel Castillo | Date: | Thu, 27 Sep 2007 21:08:24 +0000 |
| Subject: | Re: Re: usar array_walk en una clase | ||
| References: | 1 2 | Groups: | php.general.es |
| Request: | Send a blank email to general-es+get-61474@lists.php.net to get a copy of this message | ||
Prueba array_walk($datos,array($this,'setUpdate'));
Carlos Medina wrote:
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){Hola Gerardo, lo que te esta diciendo es que la function $this->setUpdate() no existe. Saludos Carlos$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; }