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

  • Home
  • SEARCH
  • 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 7888031
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T05:43:58+00:00 2026-06-03T05:43:58+00:00

I have 2 functions from separate scripts that communicate. What should happen is, if

  • 0

I have 2 functions from separate scripts that communicate. What should happen is, if a value exists, a variable should be set to %username%; if the value doesn’t exist it should be set to “None”. If the variable is set to none, the function should continue and create a new account. If the variable is set to a username, the function should continue. So, why am I getting inconsistent, erratic results?

Functions as follow, they won’t run as they call other functions that aren’t included:

def database_get_user_details(user_database, username, detail):
    value = "None"
    rows = ((users_db_curs.execute("SELECT * FROM '" + user_database + "' WHERE username='" + username + "'"))).fetchall()
    for row in rows:
        if rows:
            if detail   == ("userID")     : value = str(row[1])
            elif detail == ("username")   : value = str(row[2])
            elif detail == ("password")   : value = str(row[3])
            elif detail == ("creator_exp"): value = str(row[4])
            else                          : value = "None"
        else:
            value = "None"
    return value

def game_register(username_table_name):
    while True:
        while True:
            user_ID = raw_input("E-mail address: ")
            if user_ID != "":
                break
        while True:
            username = raw_input("Username      : ")
            if username != "":
                break
        while True:
            password = raw_input("Password      : ")
            if password != "":
                password = password.encode("hex")
                break
        usr = database_get_user_details(username_table_name, username, "username")
        print usr
        if (usr != "None") or (usr != None):
            print usr
            print "Username already taken!"
            pause()
        else:
            database_create_user(username_table_name, user_ID, username, password, "250")
            print "Successfully created %s with password: %s" %(username, password.decode("hex"))
            pause()
            break

Please note, I have not included the actual password encryption algorithm for security – I have just set it to encode to hex in this example.

Edit: Forgot to explain

It is almost as though I am calling random.choice(), I can’t find any consistency relating to whether or not the function creates a new user, or tells me that username has already been used.

  • 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-03T05:44:00+00:00Added an answer on June 3, 2026 at 5:44 am

    Your code for existing users will always trigger because at least one of the inequalities will be true.

    if (usr != "None") or (usr != None):
            print usr
            print "Username already taken!"
            pause()
    

    The condition should be

    if (usr != "None") and (usr != None):
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a c# project that calls some functions from a c dll, the
I have a bunch of generated functions from a supplier's tool are required to
i have an html email being generated by certain php functions and collected from
i have a problem using some php functions on a string i get from
I'll have couple of python functions I must interface with from the assembly code.
I have an application that needs to join tables from multiple databases into a
I have a set of jQuery UI AJAX tabs that load individual .php pages
I am working on a javascript framework. I have several independent scripts that look
I was recently told that I should keep my code in separate files; like
I have some JavaScript that is sharing a request between two separate servers on

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.