Ver Mensaje Individual
  #5 (permalink)  
Antiguo 26/03/2012, 23:41
vani18
 
Fecha de Ingreso: junio-2010
Mensajes: 752
Antigüedad: 13 años, 10 meses
Puntos: 5
Respuesta: obtener filas o matriz de mysql

me salio de esta manera...



Código PHP:
$buscando "select foto, nombre from productos where oferta=1";
$busca mysql_query($buscando,$link);

$filas mysql_num_rows ($busca);  
        
        if (
$filas 0)  
        {  
            for (
$i=0$i<$filas$i++)  
            {  
            
                
$variable mysql_fetch_array($busca);  
                
$nombre_foto[$i] = $variable["foto"];  
                
$nombre_art[$nombre_foto[$i]] = $variable["nombre"]; 
                
            }                      
        }  

        
        
$foto1=$nombre_foto[0];
        
$articulo1=$nombre_art[$nombre_foto[0]];
        
$foto2=$nombre_foto[1];
        
$articulo2=$nombre_art[$nombre_foto[1]];
        
$foto3=$nombre_foto[2];
        
$articulo3=$nombre_art[$nombre_foto[2]];
        
$foto4=$nombre_foto[3];
        
$articulo4=$nombre_art[$nombre_foto[3]]; 

no se si es el mas conveniente, pero mientras funcione.... igual voy a ver.. lo de for each.... por q si no se que es FOREACH , ---- directamente NO SE NADA....