ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> php-spanish
php-spanish
[PHP-ES] Un problema sencillo pero que no encuentro como resolver
by Reynier Perez Mira other posts by this author
Nov 16 2006 7:58AM messages near this date
RE: [PHP-ES] Como generar una firma electronica con SHA1 de forma segura | [PHP-ES] como imprimo para que me salga el espacio de str_pad()
Hola listeros y buenos d�as:
Tengo un peque�o problema que no logro resolver. El caso es que tengo que imprimir una tab
la en esta forma:

Juan	Programacion1	TCP1		5	Programacion2		TCP1	5	Matem�tica	TCP1	3
Juan	Programacion1	TCP2		2 	Programacion2		TCP2	3	Matem�tica	TCP2	2
Juan	Programacion1	TCP3		3 	Programacion2		Criterio	5	Matem�tica	TCP3	4
Juan	Programacion1	Criterio		5						Matem�tica	Final	5
Juan											Matem�tica	Criterio	2

Pedro	Programacion1	TCP1		5	Programacion2		TCP1	5	Matem�tica	TCP1	3
Pedro	Programacion1	TCP2		2 	Programacion2		TCP2	3	Matem�tica	TCP2	2
Pedro	Programacion1	TCP3		3 	Programacion2		Criterio	5	Matem�tica	TCP3	4

Lo que me pasa es que no logro darle ese formato a la tabla. Miren lo que tengo hecho hasta 
el momento:

$arr['Juan']['Programacion1']['TCP1'] = 5;
$arr['Juan']['Programacion1']['TCP2']=2;
$arr['Juan']['Programacion1']['TCP3']=5;
$arr['Juan']['Programacion1']['Criterio']=5;
$arr['Juan']['Programacion2']['TCP1']=5;
$arr['Juan']['Programacion2']['TCP2']=5;
$arr['Juan']['Programacion2']['Criterio']=5;
$arr['Pedro']['Programacion1']['TCP1']=2;
$arr['Pedro']['Programacion1']['TCP2']=2;
$arr['Pedro']['Programacion1']['TCP3']=5;
$arr['Pedro']['Programacion1']['Criterio']=5;

$output = '<table width="100%" border="1" cellpading="1" cellspacing="2"> ';
$nota_final = 0;
foreach ($arr as $node1=> $node2)
{
	foreach ($node2 as $node3=> $node4)
	{
		$output.= '<tr> ';
		foreach ($node4 as $node5=> $node6)
		{
			$nota_final+= $node6;
			$output.='<td> '.$node1.'</td>';
			$output.='<td> '.$node3.'</td>';
			$output.='<td> '.$node5.'</td>';
			$output.='<td> '.$node6.'</td>';
			$output.='<td> '.$nota_final.'</td>';
		}
		$output.= '</tr> ';
	}
}
$output.= '</table> ';
echo $output;

Pero eso me imprime las cosas mal. �Alguien que me de una ayudita?
Salu2, gracias por adelantado y esperando respuestas
--
ReynierPM
5to Ing. Inform�tica
Maestro de poco, aprendiz de mucho

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved