Servando Garcia wrote:
> Hello to all
> I have been trying to insert data into a database using MySQLdb
> with no success. I have no idea why this script is not working. I took
> it from a tutorial from DEV Shed.
What happens when you try it? "Not working" doesn't give us much to go
on. If you get an error message, show it to us with the complete stack
trace (copy and paste the whole thing). Did it run without error but not
change the database?
>
> #!/usr/bin/python
> import MySQLdb
> # connect
> db = MySQLdb.connect(host="localhost", user="root",
> passwd="******",db="tutorial")
>
> # create a cursor
> cursor = db.cursor()
>
> #User Input
> name = raw_input("Please enter a name: ")
> color = raw_input("Please enter a color: ")
>
> #Insert data into table "Horses"
> cursor.execute("INSERT INTO horses(Names,Color) VALUE (%s,%s)",(name,color))
Should be VALUES
Kent
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor