Jump to content

Weird undefined offset while working with JSF framework


agustincarban

Recommended Posts

Hi guys !. My name is AGustin and I live in argentina. Just wanted to know why I am getting this error:

Notice: Undefined offset: 1 in C:\wamp\www\conf.php on line 8

from this code:

<?php
   $link = mysql_connect("localhost","root","");
   mysql_select_db("usuarios",$link);

   $palabra = $_GET["q"];
   //$palabra = "agus#carban";
   $vector = explode("#",$palabra);
   $consulta = "SELECT * FROM usuario WHERE nombre='".$vector[0]."' AND pass='".$vector[1]."'";

   $querry = mysql_query($consulta,$link);

   $rdo = "No";
   if(mysql_num_rows($querry)>0)
   {
        $rdo = "Si";
   }

   echo $rdo;
?>

I've done all kind of manual debugging I can't manage to solve this ! :D Hope I can get it working...

Pikachu2000. What's up ?. Thankx for asnwering... The thing was "killing me" so look what I did...

<?php
   $link = mysql_connect("localhost","root","");
   mysql_select_db("usuarios",$link);

   $palabra = $_GET["q"];
   $file = fopen('debug.txt', 'w');
   //$palabra = "agus#carban";
   fwrite($file, $palabra);
   fclose($file);

   $vector = explode("#",$palabra);
   $consulta = "SELECT * FROM usuario WHERE nombre='".$vector[0]."' AND pass='".$vector[1]."'";

   $querry = mysql_query($consulta,$link);

   $rdo = "No";
   if(mysql_num_rows($querry)>0)
   {
        $rdo = "Si";
   }

   echo $rdo;
?>

 

and it result that when I open "debug.txt" there wasn't any "#" so I'll see why this is hapenning... As soon as I get it working I'll answer again...

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.