Guest User

Untitled

a guest
Nov 13th, 2017
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. import mysql
  2. import mysql.connector
  3. import command
  4. import datetime
  5.  
  6. def findarbs(startdate, enddate):
  7. con = mysql.connector.connect(user='root', password='root',
  8. host='localhost',port='3306',database='testdb')
  9. cur = con.cursor()
  10. command = ("SELECT DISTINCT id, date FROM babyrop", WHERE 'date1'
  11. > ('%s') AND 'date2' < ('%s'), ORDER BY date asc % (startdate,
  12. enddate))
  13. print ('command')
  14. cursor.execute(command)
  15. result = cur.fetchone()
  16. print (result)
  17. while result is not None:
  18. print (result[1])
  19. result = cursor.fetchone()
  20. cur = con.cursor()
  21. cur.execute('select id, date weight from babyrop')
  22.  
  23. data = cursor.fetchall()
  24. cur.close()
  25. con.close()
Add Comment
Please, Sign In to add comment