Jump to content

Undefined Index


xonnaddo

Recommended Posts

Estou com esses erros no meu site, oque é???

 

 

Notice

: Undefined index: poll in

C:\Users\Sandro\Desktop\USBWebserver v8.5\8.5\root\Portal\inc\poll.php

on line

3

 

Notice

: Undefined index: result in

C:\Users\Sandro\Desktop\USBWebserver v8.5\8.5\root\Portal\inc\poll.php

on line

10

 

Notice

: Undefined variable: poll_id in

C:\Users\Sandro\Desktop\USBWebserver v8.5\8.5\root\Portal\inc\poll.php

on line

10

 

Notice

: Undefined index: voted in

C:\Users\Sandro\Desktop\USBWebserver v8.5\8.5\root\Portal\inc\poll.php

on line

10

 

Notice

: Undefined variable: poll_id in

C:\Users\Sandro\Desktop\USBWebserver v8.5\8.5\root\Portal\inc\poll.php

on line

17

 

Warning

: mysql_num_rows() expects parameter 1 to be resource, boolean given in

C:\Users\Sandro\Desktop\USBWebserver v8.5\8.5\root\Portal\inc\poll.php

on line

18

Link to comment
https://forums.phpfreaks.com/topic/274027-undefined-index/
Share on other sites

In English, please? This is an English-speaking community, after all.

Thank you.

 

In any case an "undefined index" means that you're trying to reference an array key, which has not been set yet. The proper way to fix these messages, is by checking if the key isset () before trying to use its value.

 

Like this:

// Test data
$test = array ("Exists" => true);

// Gives an undefined index.
echo $test['not'];

// Test first.
if (isset ($test['not')) {
    // No message, and no warning.
    echo "You won't see this.";
} else {
    echo "Index 'not' is not set.";
}

Link to comment
https://forums.phpfreaks.com/topic/274027-undefined-index/#findComment-1410114
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.