如何使用pyqt在标签上显示数据计数

How to display count of data onto the label using pyqt

self.pushButton786.clicked.connect(self.refresh)

def refresh(self):

    db = MySQLdb.connect('localhost', 'root', 'Suhel786', 'project')
    cursor = db.cursor()
    a=cursor.execute("select count(*) from donor")
    b=cursor.execute("select count(*) from customer")
    c=str(a)
    d=str(b)
    self.label_8.setText(c)
    self.label_9.setText(d)
    db.close()

即使数据库中没有数据,也总是给出 1...

self.pushButton786.clicked.connect(self.refresh)

def refresh(self):

    db = MySQLdb.connect('localhost', 'root', 'Suhel786', 'project')
    cursor = db.cursor()
    cursor.execute("select count(*) from donor")
    a=fetchchone()
    b=int(a[0])
    cursor.execute("select count(*) from customer")
    c=fetchchone()
    d=int(c[0])
    self.label_8.setText(str(b))
    self.label_9.setText(str(d))
    db.close()