Fatal error: Call to a member function getTeamPlayers () on a non-object in D: \ xampp \ htdocs \ chpp \ chpp2 \ index.php on line 49
el codigo que uso es este:
Código PHP:
<?php
if ($_POST['login']){
login();
}
else{
if ($_GET['opcion']=="jugadores"){
jugadores();
}
else{
principal();
}
}
function principal(){?>
<form action="" method="POST">
<input type="text" name="user"><br>
<input type="password" name="pass"><br>
<input type="submit" name="login" value="login">
</form><?php
}
function login(){
include('PHT.php');
$user=$_POST['user'];
$pass=$_POST['pass'];
$HT=new CHPPConnection('nukestats','');
if( $HT->connectUser($user,$pass))
{
session_start();
$_SESSION['HT'] = $HT;
$team = $HT->getTeam();
echo $team->getTeamName().' '.$team->getShortTeamName().' '.$team->getTeamId()."<br/>";
echo $team->getArenaName().' '.$team->getArenaId()."<br/>";
echo $team->getDessCode().' '.$team->getDessAlternateCode()."<br/>";
echo $team->getLanguageName().' '.$team->getLanguageId()."<br/>";
echo $team->getLeagueName().' '.$team->getLeagueId()."<br/>";
echo $team->getLeagueLevelName().' '.$team->getLeagueLevelId()."<br/>";
echo $team->getRegionName().' '.$team->getRegionId()."<br/>";
echo $team->getTrainerName().' '.$team->getTrainerId()."<br/>";
echo $team->getTeamRank()."<br/>";
if($team->isBot())
{
echo $team->getBotDate('Y-m-d')."<br/>";
}
if($team->isInCup())
{
echo $team->getCupName().' '.$team->getCupId()."<br/>";
}
if($team->isHtSupporter())
{
echo $team->getNumberMessageInGuestbook()."<br/>";
echo $team->getPressAnnouncementDate().' '.$team->getPressAnnouncementTitle()."<br/>";
echo $team->getPressAnnouncementText()."<br/>";
}
?>
<a href="index.php?opcion=jugadores">Jugadores</a><?php
}
else{
echo "error al entrar";
}
}
function jugadores(){
include('PHT.php');
$HT = $_SESSION['HT'];
$teamPlayers = $HT->getTeamPlayers();
echo $teamPlayers->getTeamName().' ('.$teamPlayers->getTeamId().')';
for($i=1; $i<=$teamPlayers->getNumberPlayers(); $i++)
{
$player = $teamPlayers->getPlayer($i);
echo $player->getName()." ".$player->getId()."<br>";
echo $player->getAge().' years '.$player->getDays().' days'."<br>";
echo $player->getForm()."<br>";
echo $player->getSalary(HTMoney::Argentina)."<br>"; // will output salary for country currency
echo $player->getTsi()."<br>";
echo $player->getGoalsInCareer().' '.$player->getGoalsInCup().' '.$player->getGoalsInLeague()."<br>";
echo $player->getInjury()."<br>";
echo $player->getCards()."<br>";
}
}
?>
que estoy haciendo mal?
desde ya muchas gracias como siempre