Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def getplayer1name(candidatenumber):
- # search the database for the forename related to the candidate number
- # inputted by player 1, use this name to address them in the game.
- cnx = mysql.connector.connect(host='localhost', user='ballt',
- password='password',database='pythondb')
- cursor = cnx.cursor()
- cursor.execute("""SELECT Forename FROM pythondb.student """
- """WHERE CandidateNumber = %s""" % (candidatenumber))
- for row in cursor.fetchall():
- output = row[0]
- return output
- cnx.close() # close the connection to the database to reduce processing overheads
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement