Hi All I have been trying to fix this problem but in vain..I would really appreciate if someone can help... When i try to run my php file it gives me this Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 3. I have no clue why! Thanks in advance Regards Ada
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <?php extract ( $_POST ); print("$pass_word"); ?> <html xmlns = "http://www.w3.org/1999/xhtml"> <head> <title>Login</title> </head> <body style = "font-family: arial,sans-serif"> <form method="post" action=""> <p>Username <input type="text" name="username" size="20"></p> </form> <p>Password<input type="text" name="pass_word" size="20"></p> <form method="post" action="http://localhost/welcome_to_Arjita.php"> <p><input type="submit" value="Submit" name="B3"></p> </form> <?php $user="root"; $password_database=""; $database="DB"; if (! ( $database = mysql_connect(localhost,$user,$password_database) ) ) die ( "Could not connect to database" ) ; if (!mysql_select_db( "DB" , $database ) ) die ( "Could not open database " ); $query = ("SELECT * FROM USER where LoginId='$username'"); if ( !( $result = mysql_query ( $query, $database ) ) ) { print ( "Could not execute query! <br />" ); die ( mysql_error() ); mysql_close(); } $row = mysql_fetch_row ($result); $i=0; if ($username == "Cool"){ $i=1; } $Password=mysql_result($result,$i,"Password"); if ('$Password' != '$pass_word'){ echo"Please try again"; } ?> </body> </html> Thanks Ada
That error generally means the row or column you specified in the call to mysql_result doesn't exist. Generally, I only use mysql_result if I'm extracting a field from a one-column one-row (1x1) result. If you have multiple columns and/or multiple rows, I would advise you to use mysql_fetch_assoc instead.