user5443928
user5443928

Reputation:

Could not fetch data from Database using MySQL query

I have an issue.I need to fetch data from a Database using PHP and MySQL but its displaying the following message:

MySQL returned an empty result set (i.e. zero rows). ( Query took 0.0021 sec )

I have 1 set of data like the below table.

kf_admin:

id   username   password    status

1    admin      8bb7101921   1

The password part is an encrypted password and its datatype is varchar. When I execute the following query it results in the above message.

select * from kf_admin where username='admin' and password='8bb7101921' ;

But when I remove the password part from the query, it show the row data. Please help me to resolve this issue.

Upvotes: 2

Views: 944

Answers (1)

Priyanshu
Priyanshu

Reputation: 881

select * from kf_admin where trim(username)='admin' and trim(password)='8bb7101921' ;

Try this, may be leading or trailing space in the field

Upvotes: 3

Related Questions