473,396 Members | 2,068 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Trouble with login page

Hi,
I am having a few issues with a login script i have created.
If the username is not in the database it give me an error:

Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 2 in /home/jeannefl/public_html/players-vintage/load_login.php on line 8

heres my code:

$query = ("SELECT * FROM user WHERE email = \"". $email . "\"");
$result = mysql_query($query);
if($password == mysql_result($result,0,"password")){
$firstname = mysql_result($result,0,"firstname");
$lastname = mysql_result($result,0,"lastname");
session_start();
session_register ("email");
session_register ("firstname");
session_register ("lastname");
$HTTP_SESSION_VARS ["email"] = $email;
$HTTP_SESSION_VARS ["firstname"] = $firstname;
$HTTP_SESSION_VARS ["lastname"] = $lastname;
$page = "home.php";
}else{
$page = "fail.html";
}
header("Location: " . $page);
mysql_close();
?>

Thanks for any help
Apr 14 '07 #1
1 1139
Motoma
3,237 Expert 2GB
If I were to guess, your query returned no results.
I recently posted a tutorial on creating a data abstraction layer to assist with technical issues such as this, take a look if you continue to have troubles like this.



Hi,
I am having a few issues with a login script i have created.
If the username is not in the database it give me an error:

Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 2 in /home/jeannefl/public_html/players-vintage/load_login.php on line 8

heres my code:

$query = ("SELECT * FROM user WHERE email = \"". $email . "\"");
$result = mysql_query($query);
if($password == mysql_result($result,0,"password")){
$firstname = mysql_result($result,0,"firstname");
$lastname = mysql_result($result,0,"lastname");
session_start();
session_register ("email");
session_register ("firstname");
session_register ("lastname");
$HTTP_SESSION_VARS ["email"] = $email;
$HTTP_SESSION_VARS ["firstname"] = $firstname;
$HTTP_SESSION_VARS ["lastname"] = $lastname;
$page = "home.php";
}else{
$page = "fail.html";
}
header("Location: " . $page);
mysql_close();
?>

Thanks for any help
Apr 14 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Eric Shi | last post by:
Hi, I use ASP.Net build a web application which requires users to login. The link is sent out to the user via email. The users then click the link in the email and the login page is...
0
by: khawar | last post by:
here is my code that i am using to send the post to verisign: using System.Drawing; using System.Data; using System.Data.SqlClient; using System.Data.OleDb; using System; using System.Web.UI;...
6
by: Daniel Walzenbach | last post by:
Hi, I have an application using "Forms authentication". Everything works perfectly well except when I try to open a new page with java script like the following: <script...
4
by: Brent Waldrop | last post by:
Ok everyone, i have been pulling my hair out on this one. I have been working on it for 3 days with no sucess. This problem is occuring at home where i am running a workgroup. I have Windows 2003...
3
by: Jake Barnes | last post by:
I thought I understood this article: http://simon.incutio.com/archive/2004/05/26/addLoadEvent It seems like a smart, insightful function: function addLoadEvent(func) { var oldonload =...
0
by: R. Tschirley | last post by:
Hi all, I've got some annoying trouble with IE's display of my new website header. On my site, the corporate logo shall be right-aligned: ...
8
tolkienarda
by: tolkienarda | last post by:
hi all i have a login script that is simplified with out any extra stuff. and it doesn't seem to work. i think the problem is something to do with session variables. but i am not sure what it is....
9
by: SA SA | last post by:
Hello i am not PHP expert - i need help big time. i am having issue with PHP session i think. I have two page login.php and admn.php As name implied login to log in to admin page manage...
4
by: DavidPr | last post by:
I'm using Jpmaster77 a.k.a. The Grandmaster of C++ 's register/login system and I'm having a problem with the session being dropped when I try to submit a form to the same page. A user has to...
2
by: gradinafrica | last post by:
I'm trying to create a log out button that uses AJAX to call a php file which ends the current session: //logout.php <?php if (!session_start()); session_destroy(); //Destroys the...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.