Пример #1
0
function promedio ($liga, $tipo, $jugador) {
	$partidostot = partidosjug ($liga, $jugador) ;
	if ( $partidostot == 0) {
		return 0 ;
	}	
	switch ( $tipo ) {
		case 'gol':
			$retorno = difgoles($liga, $jugador, null) / $partidostot ;
		break;
	
		case 'punto':
			$retorno = partidosG($liga, $jugador, null) * 3 +  partidosE($liga, $jugador, null) ;
			$retorno = $retorno / $partidostot ;
		break;

		default:
		$retorno = 'function promedio: error tipo' . $tipo ;
		break;
	}
	return $retorno;
}
Пример #2
0
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 ;
}