Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8889095
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T22:10:44+00:00 2026-06-14T22:10:44+00:00

Hello every one i’m trying to do a login method for my website, and

  • 0

Hello every one i’m trying to do a login method for my website, and i’m having a small problem. I’m getting the data from PDO connection but every time im checking the password it returns false. is my variables wrong?
here is my sql query

$this->result = $this->sql->prepare('SELECT username,password FROM User WHERE username=:username AND password=:password');
$this->result->bindParam(':username',   $username,  PDO::PARAM_STR); 
$this->result->bindParam(':password',   $password,  PDO::PARAM_STR); 
$this->result->execute(); 

and here is my if statement:

$this->result=$this->result->fetch(PDO::FETCH_OBJ);
if (($password == $this->result->password) && ($username == $this->result->username)){

i’m not getting error it just return always false. i’m not encrypting the password yet so is not this problem. i think $this->result->password is the problem. can anyone correct me please?

thank you

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T22:10:46+00:00Added an answer on June 14, 2026 at 10:10 pm

    You can use this as well:

    $username=$_GET['username'];$password = $_GET['password'];/*of $_POST, depending of which you used*/
    $this->result = $this->sql->prepare('SELECT username,password FROM User WHERE username='$username' AND password='$password');
    

    $this->result->execute();

    And then use fetchAll like this:

    $this->results = $this->result->fetchAll(PDO::FETCH_ASSOC);
    if($this->results['username']==$this->username && $this->results['password']==$this->password){/*u had beed loged in*/}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello every One i am trying to get Ist date of All months in
hello every one i face this problem and iam too weak in DB i
hello every one i am facing a strange problem i my code i am
Hello every one I have made a small function which takes a pointer to
hello every one i got a string from csv file like this LECT-3A,instr01,Instructor 01,teacher,instr1@learnet.com,,,,male,phone,,
Hello every one here I have a problem. I have a file in which
hello every one i want to pass the php array from the javascript function
Hello every one. I'm faced with a weird problem. My application has a simple
Hello every one I want to ask a question that what is simple exec
Hello every one I have wrote a simple code in html5 in which I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.