Jun-10-2019, 09:33 AM
(This post was last modified: Apr-27-2021, 01:41 PM by AkaAndrew123.)
Really odd thing today, when I query a mysql database I am getting the number of rows returned rather that the column data !
#!/usr/bin/python
# -*- coding:utf-8 -*-
import csv
import time
import MySQLdb
try:
db = MySQLdb.connect(host="localhost", user="root", passwd="",db="pension")
cur = db.cursor()
except MySQLdb.Error, e:
print "Error One %d: %s" % (e.args[0], e.args[1])
startdate = "2019-05-18"
enddate = "2019-05-19"
print cur.execute("SELECT * FROM pension.pension_payments WHERE date >= %s AND date <= %s",(startdate,enddate))
print cur.execute("SELECT * FROM pension.pension_payments") Result would be: 4 4 but i have six columns in 4 rows idpension_payments,date,week,name,employer,employee 69,"2019-05-18 16:47:35",10,Andrew,35.67,20.00 70,"2019-05-18 16:47:36",10,Alex,35.67,11.37 71,"2019-05-18 16:47:36",10,Sharon,35.67,7.05 72,"2019-05-18 16:47:36",10,Kerry,35.67,9.13
