RON_ron Posted November 11, 2010 Share Posted November 11, 2010 this is my login php. But for some reason it dosen't log the user on the first attempt. Any idea what may be causing this? $result=mysql_query("SELECT * FROM companies WHERE username = '$user' AND password ='$pass'"); if(mysql_num_rows ($result) == 0) { $login = "&err=Failed."; echo($login); } else { $row = mysql_fetch_array($result); $user=$row['user']; $pass=$row['pass']; $login = "$user=" . $user . "$pass=" . $pass . "&err=Successful."; echo($login); } Quote Link to comment https://forums.phpfreaks.com/topic/218422-login/ Share on other sites More sharing options...
ManiacDan Posted November 11, 2010 Share Posted November 11, 2010 Ummm...what is it supposed to do? How do you "log in" a user? So far this code will print "err=Successful." (which is confusing) if the undefined variables $user and $pass exist in the table. -Dan Quote Link to comment https://forums.phpfreaks.com/topic/218422-login/#findComment-1133170 Share on other sites More sharing options...
RON_ron Posted November 11, 2010 Author Share Posted November 11, 2010 I'm using this as a server side script. The "err=Successful." will trigger the action. But the issue is why doesn't it allow the user to go through the first attempt. Always the LOGIN button needs to be clicked twice. I wonder if this that's got to do something with this piece of code? Quote Link to comment https://forums.phpfreaks.com/topic/218422-login/#findComment-1133173 Share on other sites More sharing options...
shlumph Posted November 11, 2010 Share Posted November 11, 2010 That looks ok to me, your problem is probably elsewhere. Quote Link to comment https://forums.phpfreaks.com/topic/218422-login/#findComment-1133186 Share on other sites More sharing options...
RON_ron Posted November 11, 2010 Author Share Posted November 11, 2010 Thanks guys!! Quote Link to comment https://forums.phpfreaks.com/topic/218422-login/#findComment-1133190 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.