Solved

Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 3 in (file path)

Posted on 2008-06-25
3
1,331 Views
Last Modified: 2013-12-12
I just installed Firefox 3, and it automatically entered root as the username in my website's login form and some password (I don't know what it is, since I don't have a password set for my development server).

Just to see what happens, I submit the username and password.  And I receive this error...
Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 3 in (path to my login file)

In IE and firefox 2 it did not automatically populate the form with that username and password.  But, in IE, when I use root as the user name and I copy the password over, I recieve the same error message.

I've attached my corresponding log in file
loginHTML.txt
loginPHP.txt
0
Comment
Question by:jabrthel
  • 2
3 Comments
 

Author Comment

by:jabrthel
ID: 21871443
Well, I just cleared all my private data in firefox 3, so that solved one problem... I guess it was pulling stuff from odd places.  If I place root and that same password, it still gives me a problem.  However, as long as I don't place that password in, it seems to be fine...
0
 

Author Comment

by:jabrthel
ID: 21871460
Well, I just figured out that the password being enter was localhost... so I guess my question would be, why is that particular password giving the above error, when all others are fine?
0
 
LVL 50

Accepted Solution

by:
Steve Bink earned 500 total points
ID: 21920334
I would guess that you are receiving the error not because of the password, but because of the loginID.  Your code to query the database (84-88 in loginPHP.txt):

      mysql_connect("localhost","root","");
      mysql_select_DB("database") or die("unable to select database");
      $query = mysql_query("select * from member where loginID like '$loginID'");
      $passwordSQL = mysql_result($query, 0, "password");
      mysql_close();

If $loginID does not exist in table member, then $query will return with an empty result set.  Since there would be no records, jumping to the first record would fail, presenting the error you are seeing.  You can resolve this by explicitly checking for a single-record result set, taking action if anything looks strange.  You should check that mysql_num_rows($query)==1.  If it does not (no records, or more than one record), then something went wrong.

You can test this theory by using the same user name with any password, as well as trying a real user name with the same password.
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
How to create a custom search shortcut to site-search Experts Exchange using Google in the Firefox browser. This eliminates the need to type out site:experts-exchange.com whenever you want to search the site. Launch your Bookmark Menu: Press 'Ctrl +…

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now