#-*-coding:utf-8-*-
import MySQLdb
conn = MySQLdb.connect("localhost","root","321","tymoney",port=3306,connect_timeout=10,compress=True,charset='utf8',use_unicode=True)
cursor=conn.cursor()
cursor.execute("select count(*) from accountrecord ")
row = cursor.fetchone()
recordtotal = row[0]
perrecord = 50
if recordtotal % perrecord != 0:
totalpage = recordtotal/perrecord + 1
else:totalpage = recordtotal/perrecord
for i in xrange(0,totalpage):
prelimit = i*perrecord
dysql = "select * from accountrecord limit " + str(prelimit) + "," + str(perrecord)
print dysql
|