jjacquay712 Posted September 3, 2008 Share Posted September 3, 2008 I have a PHP script that checks to see if a user name exists on a database. When MySQL gets a result everything is fine... the problem is when MySQL cant find anything. Here Is My Code: $resource2 = mysql_query("SELECT * FROM users WHERE username='{$_POST['username']}'"); $password = mysql_result($resource2, 0, 'password'); if ($password == $_POST['password']) { echo "Correct Password<br /><br />"; } else { echo "Wrong Password"; } If the user enters a correct username, he is logged on, if they don't, they get this ugly warning: Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 3 in yada yada yada. Is there anyway to make MySQL not display the warning? I have tried an or die() statement, but that didn't work. I think you might be able to change the settings in MySQL but I'm not sure. Any suggestions are greatly appreciated. Quote Link to comment Share on other sites More sharing options...
fenway Posted September 4, 2008 Share Posted September 4, 2008 Could you post your solution for the benefit of others 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.