function tabla ($id) { $tabla = "<table class='tabla'><tr><th><p>Jugador</p></th><th><p>PG</p></th><th><p>PE</p></th><th><p>PP</p></th><th><p>Dif Goles</p></th></tr>" ; $numjug = numjugadores() ; $nopo = 1 ; $opo = jugadoresid() ; $nombre = jugadoresnom() ; while ( $nopo <= $numjug) { if ($nopo == $id) {$nopo = $nopo + 1 ; } $datos = mysql_query("select * from jugadores where id= '$opo[$nopo]'"); $datos = mysql_fetch_array($datos); $partg = partidosG($id, $opo[$nopo]) ; $parte = partidosE($id, $opo[$nopo]) ; $partp = partidosP($id, $opo[$nopo]) ; $goles = difgoles($id, $opo[$nopo]) ; $tabla = $tabla . "<tr><td>$nombre[$nopo]</td><td>$partg</td><td>$parte</td><td>$partp</td><td>$goles</td></tr>" ; $nopo = $nopo + 1 ; if ($nopo == $id) {$nopo = $nopo + 1 ; } } $tabla = $tabla . "</table>" ; return $tabla ; }
$njuga = 1; $numjug = numjugadores () ; while ( $njuga <= $numjug ) { $datos = mysql_query("select * from jugadores where id= '$juga[$njuga]'"); $datos = mysql_fetch_array($datos); $jugador = $datos[jugador]; ?> <h3><a href="#"><? echo $jugador ; ?></a></h3> <div><? echo tabla($juga[$njuga]); ?></div> <? $njuga = $njuga + 1 ; } ?> </div> <div class="accordionb" id="graficos"> <? $juga = jugadoresid() ; $njuga = 1; $numjug = numjugadores () ; while ( $njuga <= $numjug ) { $datos = mysql_query("select * from jugadores where id= '$juga[$njuga]'") ; $datos = mysql_fetch_array($datos) ; if ( $datos[patidos] == 0 ) { $puntos[$njuga] = 0; } else { $puntos[$njuga] = $datos[puntos] / $datos[patidos]; $puntos[$njuga] = round($puntos[$njuga], 2); } if ( $datos[patidos] == 0 ) { $goles[$njuga] = 0; } else { $difgoles = $datos[golesF] - $datos[golesE] ; $goles[$njuga] = $difgoles / $datos[patidos] ; $goles[$njuga] = round($goles[$njuga], 2); } $njuga = $njuga + 1 ;