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 7833269
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T12:38:13+00:00 2026-06-02T12:38:13+00:00

I am trying to log into my table called acounts using MySQLdb in Python,

  • 0

I am trying to log into my table called acounts using MySQLdb in Python, but it does not work for me. I keep getting my message “Not Logged In”. Here is my code:

database = MySQLdb.connect("127.0.0.1", "root", "pswd", "Kazzah")
cursor = database.cursor()
cursor.execute("SELECT * FROM Accounts WHERE Email='%s' AND Password='%s'" % (_Email, _Password)) 
database.commit()
numrows = cursor.rowcount

if numrows == 1:
    msg = "Logged In"
else:
    msg = "Not Logged In" 

cursor.close()
database.close()

What am I doing wrong? I am new to this so I hope I’ve done somewhat good. Thanks.

  • 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-02T12:38:14+00:00Added an answer on June 2, 2026 at 12:38 pm

    For some reason (I think because of using Terminal), when I would input the info, I would have to hit Enter. I believe when I would hit enter, the ‘\n’ was inserted and is what caused the numrows to return 0.

    I placed

    .replace('\n', '')
    

    After _Email and _Password and now it works great! Now I have one other issue with something else, but nothing big. Thanks to everyone for helping!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to set up a simple login using AuthLogic into my User table.
I am facing a really weird error,while trying to insert into a table called
I am trying to log into facebook here is my code: <body> <form id=form1
I'm trying to create an app that multiple users would log into a server
I am trying to log some input values into an array via jquery and
I've been trying to find a python code that would log in to my
I have table of users called users and log table called ulog . Every
I'm trying to post data with AJAX and insert it into a database table.
I am trying to insert some values into Oracle DB from Java using the
I'm trying to bulk load around 12m records into a InnoDB table in a

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.