Jump to content

[SOLVED] MySQL Warnings - Please Help


jjacquay712

Recommended Posts

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.

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.