At 09:35 PM 2/8/2005, james middendorff wrote:
I want to use mysqldb to add people into a database,
but when I ask for the certain fields like Name,
PhoneNumber and such, I cannot get it to put them in
as a string?

You can increase your chances of getting help by telling us what happens when you execute this code.


I am not sure what I am doing wrong but
here is my code thanks to anyone who helps:
import MySQLdb

username = raw_input("what is your username? ")
password = raw_input("what is the password? ")
database = raw_input("what database do you want to
enter? ")
conn = MySQLdb.connect(host='127.0.0.1',
user=username, passwd=password, db=database)

c = conn.cursor()

Name = raw_input("what is the name you want to add? ")
PhoneNumber = input("what is the phone number for the
person you are adding? ")
Address = raw_input("what is the address for the
person you are adding? ")
EmailAddress = raw_input("what is the email address of
the person you are adding? ")
BirthDate = raw_input("what is the birthdate of the
person you are adding? year-month-day")


c.execute (""" INSERT INTO people () VALUES ('%s','%s','%s','%s','%s'); """)% (Name, PhoneNumber, Address, EmailAddress, BirthDate)

print "%d rows were inserted" % c.rowcount

=====
"I would kill everyone in this room
    for a drop of sweet beer."
     ----Homer Simpson----



__________________________________
Do you Yahoo!?
The all-new My Yahoo! - What will yours do?
http://my.yahoo.com
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Bob Gailer
mailto:[EMAIL PROTECTED]
303 442 2625 home
720 938 2625 cell


_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to