Hi guys

I'm trying to place a user input into a database(mysql)

newplayer=raw_input('Please enter a new player name: ")

the sql commands to insert data is

sql="""INSERT INTO PLAYERS(NAME) VALUES('newplayer')"""

When i check the database it shows newplayer instead of what the user has entered.
any ideas of how i can solve this

sql="""INSERT INTO PLAYERS(NAME) VALUES('%s')""" % newplayer

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.