Foros del Web » Programando para Internet » PHP »

PHP OO Error en codigo get

Estas en el tema de Error en codigo get en el foro de PHP en Foros del Web. OLA AYUDA CON ESTE CODIGO ME SALE ERROR POR LA VARIABLE $_GET['ID'] SU ARRAY ES 0... ESTE ES EL CODIGO : $i=$_GET['id']; $con=mysql_query("select * from ...
  #1 (permalink)  
Antiguo 07/03/2012, 16:37
 
Fecha de Ingreso: junio-2010
Mensajes: 10
Antigüedad: 13 años, 10 meses
Puntos: 0
Pregunta Error en codigo get

OLA AYUDA CON ESTE CODIGO ME SALE ERROR POR LA VARIABLE $_GET['ID'] SU ARRAY ES 0... ESTE ES EL CODIGO :

$i=$_GET['id'];

$con=mysql_query("select * from cliente where codcli=$i");
$cEdi=mysql_fetch_array($con);

ME SALE UN ERROR PORQUE EL ARRAY ESTA VACIO EL $_GET['id'];
COMO HAGO PARA INDICARLE QUE SI EL ARRAY ESTA VACIO O ES NULL O ES 0 QUE NO ME BOTE ERROR :

Notice: Undefined index: id in C:\xampp\htdocs\lyl\Operaciones.php on line 24

ESPERO M AYUDEN O ME INDIQUEN DONDE PUEDO ENCONTRAR LA SOLUCCION DE ANTEMANO MUCHAS GRACIAS ....
  #2 (permalink)  
Antiguo 07/03/2012, 16:40
Avatar de chwc  
Fecha de Ingreso: julio-2008
Ubicación: Buenos Aires ! :D
Mensajes: 814
Antigüedad: 15 años, 8 meses
Puntos: 103
Respuesta: Error en codigo get

la funcion isset($variable) retorna true si existe la variable, y false si no, para saberlo utilizas el
if(isset($_GET['id']))

saludos
  #3 (permalink)  
Antiguo 07/03/2012, 17:13
 
Fecha de Ingreso: junio-2010
Mensajes: 10
Antigüedad: 13 años, 10 meses
Puntos: 0
Respuesta: Error en codigo get

Gracias por tu ayuda era lo k necesitaba ....Estoi Empezando con Php y a Darle con todo Gracias

Etiquetas: sql, variables
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 08:26.