mysql_result()[function.mysql-result]:Unable to jump to row 0 on MySQL result index

Discussion in 'PHP' started by Ada chawla, Jun 12, 2007.

  1. #1
    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
     
    Ada chawla, Jun 12, 2007 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    Post your code please.
     
    nico_swd, Jun 12, 2007 IP
  3. Ada chawla

    Ada chawla Guest

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    <!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
     
    Ada chawla, Jun 12, 2007 IP
  4. SeLfkiLL

    SeLfkiLL Active Member

    Messages:
    85
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    50
    #4
    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.
     
    SeLfkiLL, Jun 12, 2007 IP