i have two admin
one admin name : dinesh password :dinesh
another admin :ramesh password :ramesh
the output is success if the admin name is ramesh and error if the admin name is dinesh could somebody explain me
dineshiop please UseCodeTags while posting source codes. It makes the code readable. I've added some comments to your code to help you with your problem
Hi Dinesh,
Your logic to find the existence of user is wrong.You are iterating through all the records of admin table
& assigning it to same variable.Thats why only "ramesh" is getting logged in it to your system.User Where clause for
finding the user.Hope you understood.
dineshiop kumar
Greenhorn
Joined: Mar 05, 2009
Posts: 13
posted
0
mean to say i should write the clause like this
select user , password from admin where user = a and password = b
even though i use i how to compare the data and display can anybody say
dineshiop kumar
Greenhorn
Joined: Mar 05, 2009
Posts: 13
posted
0
ANYBODY THERE TO HELP ME
Surya Kant
Ranch Hand
Joined: Mar 29, 2005
Posts: 104
posted
0
Yes you are correct.Execute the query with user name & password which you have got from request.If Resultset returns some entries then it means login successful.Otherwise fail.
Bauke Scholtz
Ranch Hand
Joined: Oct 08, 2006
Posts: 2458
posted
0
Geesh, I was about to post a very helpful and detailed answer until I read this:
dineshiop kumar wrote:ANYBODY THERE TO HELP ME
Impatiently kicking a topic up after less than 10 minutes and shouting to the world, while the other half of the world is still asleep at the time you posted it, is really not the way to get respect from others.
I have gone through your code.... change the query as
"String sql = "select * from admin where admin_id=user and admin_password=pass";
Bauke Scholtz
Ranch Hand
Joined: Oct 08, 2006
Posts: 2458
posted
0
Just wondering, did you really need 2 days to find this out? At any way, this isn't the core problem. There is much more at matter.
uttam chandu
Greenhorn
Joined: Mar 24, 2009
Posts: 4
posted
0
hello mister..... i had gone through that code and compiled that code also.... i got result also..... don't loose words ok........ hold your controllllll....
Bauke Scholtz
Ranch Hand
Joined: Oct 08, 2006
Posts: 2458
posted
0
That you got result doesn't explicitly mean that the code is written proper and efficient and working in all circumstances. And please work on your attitude.