Skip to content

Instantly share code, notes, and snippets.

@ghousseyn
Last active July 14, 2017 16:32
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 ghousseyn/60e6692f07156b6e02b35d60860fddd1 to your computer and use it in GitHub Desktop.
Save ghousseyn/60e6692f07156b6e02b35d60860fddd1 to your computer and use it in GitHub Desktop.
import pymysql
conn = pymysql.connect(host='localhost', port=3356, user='root', passwd='1234', db='dev')
cur = conn.cursor()
#cur.execute("CREATE TABLE coda (id int(11) not null AUTO_INCREMENT, name varchar(20) null, age int(2) null, PRIMARY KEY(id))")
cur.execute("INSERT INTO coda (name, age) VALUES ('hafid', 33)")
conn.commit()
cur.execute("SELECT * FROM coda")
#results = cur.fetchall()
print()
for row in cur:
print(row)
cur.close()
conn.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment