Ver Mensaje Individual
  #3 (permalink)  
Antiguo 03/03/2008, 14:03
Avatar de quinqui
quinqui
 
Fecha de Ingreso: agosto-2004
Ubicación: Chile!
Mensajes: 776
Antigüedad: 19 años, 8 meses
Puntos: 56
Re: recorrer variables existentes

Holas suntus

Usando variables variables puedes crear las variables que nos muestras:

Código PHP:
while ($fila mysql_fetch_array($resultadoMYSQL_ASSOC)) {

$variable "cantidad_".$fila["id"];
$
$variable $fila["id"];  // Acá yo asumí que querías guardar en la variable el valor del ID...
if ($$variable != '') {echo 'esta lleno';}


Esta solución está a medio probar, y creo que no sería lo óptimo. Por eso, yo te pregunto si no sería mejor usar un arreglo (asociativo)?

Código PHP:
$cantidad = array();

while (
$fila mysql_fetch_array($resultadoMYSQL_ASSOC)) {

$cantidad[$fila["id"]] = $fila["id"];  // Acá yo asumí que querías guardar en la variable el valor del ID...
if ($cantidad[$fila["id"]] != '') {echo 'esta lleno';}


__________________
pipus.... vieeeeeji plomius!!!
*quinqui site*