agustincarban Posted November 23, 2010 Share Posted November 23, 2010 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 ! Hope I can get it working... Quote Link to comment Share on other sites More sharing options...
agustincarban Posted November 23, 2010 Author Share Posted November 23, 2010 Well I am trying to do a validation system with a php file in a JSF framework but first I am trying it in a html file... Hope I can solve this ! Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted November 23, 2010 Share Posted November 23, 2010 $vector[1] is undefined. Are you sure the value in $_GET['q'] has a value before and after the # sign? Quote Link to comment Share on other sites More sharing options...
agustincarban Posted November 23, 2010 Author Share Posted November 23, 2010 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... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.