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
https://forums.phpfreaks.com/topic/122634-solved-mysql-warnings-please-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.