Skip to content

Instantly share code, notes, and snippets.

Created November 21, 2013 02:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/7575065 to your computer and use it in GitHub Desktop.
Save anonymous/7575065 to your computer and use it in GitHub Desktop.
import MySQLdb
basededatos = MySQLdb.connect(host='localhost',passwd='1234',user='root', db = 'test' )
cursor = basededatos.cursor()
id_proyecto = input ("ingrese id del proyecto:")
nombre = raw_input ("Ingrese nombre: ")
responsable = raw_input ("Ingrese nombre del responsable: ")
fecha_inicio= input ("Ingrese fecha (fomarto y-m-d):")
estado= raw_input("Ingrese el estado: ")
historial = raw_input("Ingrese historial: ")
insert="""
INSERT INTO
`test`.`Proyecto`
(
id_proyecto,
Nombre,
responsable,
estado,
fecha_inicio,
historial
)
VALUES
('%s', "%s", '%s', '%s','%s', '%s');
""" % (
id_proyecto,
nombre,
responsable,
estado,
fecha_inicio,
historial
)
cursor.execute(insert)
basededatos.commit()
basededatos.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment