Ver Mensaje Individual
  #3 (permalink)  
Antiguo 31/03/2016, 10:40
elvis_baracoa
 
Fecha de Ingreso: abril-2012
Ubicación: Chile
Mensajes: 2
Antigüedad: 12 años
Puntos: 0
Respuesta: recorrer mysql_fetch_array de forma automatica

$buscar = mysql_query("SELECT * FROM producto WHERE rel_empresa_id='2'");
while ( $campos = mysql_fetch_field($buscar) ){
$la_fila[] = $campos->name;
}


for ( $i=0; $i<count($la_fila); $i++ ){
echo $la_fila[$i];
echo ' | ';
}

while ( $row = mysql_fetch_array($buscar) ){
echo 'line: <br>';
for ( $i=0; $i<count($la_fila); $i++ ){

echo $row[$la_fila[$i]];
echo ' ';
}

}