Ver Mensaje Individual
  #1 (permalink)  
Antiguo 25/11/2010, 05:18
Avatar de Vun
Vun
Colaborador
 
Fecha de Ingreso: agosto-2009
Ubicación: Benalmádena, España
Mensajes: 2.265
Antigüedad: 14 años, 9 meses
Puntos: 150
Pregunta Sobre 'Undefined index' y variables de sesión

Una pregunta tonta, ¿por qué con esto...

Código PHP:
if ($_SESSION['variable']==1) { 
...me da el error:

Notice: Undefined index: variable in archivo.php on line 134

Y sin embargo con...

Código PHP:
if (isset($_SESSION['variable']) and $_SESSION['variable']==1) { 
...no me sale el error. ¿haceis vosotros todas las comprobaciones de variables de sesion de esta 'doble' forma?

Por cierto, invirtiendo el orden tambien da el error:

Código PHP:
if ($_SESSION['variable']==and isset($_SESSION['variable'])) {