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...

Link to comment
Share on other sites

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...

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.