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... Link to comment https://forums.phpfreaks.com/topic/219531-weird-undefined-offset-while-working-with-jsf-framework/ 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 ! Link to comment https://forums.phpfreaks.com/topic/219531-weird-undefined-offset-while-working-with-jsf-framework/#findComment-1138230 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? Link to comment https://forums.phpfreaks.com/topic/219531-weird-undefined-offset-while-working-with-jsf-framework/#findComment-1138231 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... Link to comment https://forums.phpfreaks.com/topic/219531-weird-undefined-offset-while-working-with-jsf-framework/#findComment-1138256 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.