Arrow

Undefined index: teamtosort | Peter's Sports League Standings | Forum

Back to the sports standings script page

Please consider registering
guest

Log In

Lost password?
Advanced Search

— Forum Scope —

  

— Match —

   

— Forum Options —

   

Minimum search word length is 4 characters - maximum search word length is 84 characters

Topic RSS
Undefined index: teamtosort
February 28, 2012
6:44 pm
John
Guest

Thank you for sharing your great script.

I am getting Undefined index: teamtosort errors in standings.php from the

"Past Games" and "Upcoming Games" sections in the corresponding lines

if ($teams['teamid'] == $_POST['teamtosort']) {

Do you have any amendments to the code which would solve the problem and reduce the php errors?

February 28, 2012
6:55 pm
Peter
Admin
Forum Posts: 841
Offline

Yes, you could add an isset:

if( isset( $_POST['teamtosort'] ) && $teams['teamid'] == $_POST['teamtosort'] ) {
March 3, 2012
2:51 pm
Rob
Guest

There are a few others like this too.

From memory I think the string starts with $score_xxxxxxx.

I think it was in the team history section.

This is just another isset check as current php will serve a notice for unset variables.

Good luck.

If I can remember what file it was I will update here.

Rob.

March 7, 2012
1:55 pm
John
Guest

Undefined variables: score_game_filter and score_sort in /standings/standings_functions.php on line 74, referer: /standings/standings.php?conf=X

Please can you advise the relevant code changes to be made to reduce the errors. Thanks

March 7, 2012
3:53 pm
John
Guest

also have error message

Undefined variable: i in /standings/admin_files/divisions.php on line 26, referer: /standings/update.php?action=mainview&conf=X

any advice on what to change and where? thanks in anticipation

March 8, 2012
9:01 am
Peter
Admin
Forum Posts: 841
Offline

Regarding the first, you can define score_sort and score_game_filter at the top of the function:

$score_sort = '';
$score_game_filter = '';

For the second, it is a bit more involved:

1. define $i = 0; before the "while" statement (line 14)
2. increment the variable before the closing "while" bracket (line 28): ++$i;