$sql = mysql_query(...); $vars = array(); while($datos = mysql_fetch_assoc($sql)) { $vars[] = $datos;} echo '<pre>';print_r($vars);echo '</pre>';