123456789101112131415161718192021 |
- #!/usr/bin/python
- # -*- coding: utf-8 -*-
- import sys, os
- import MySQLdb
- connection = MySQLdb.connect(host = "localhost", user = "user", passwd = "password", db = "dolibarr_database")
- cursor = connection.cursor()
- cursor.execute("select count(*) from llx_adherent where statut = '1'")
- row = cursor.fetchone()
- nbadherents = open('/path/to/your/web/directory/nbadherents','w')
- nbadherents.write(str(row[0]))
- nbadherents.close()
- cursor.close()
- connection.close()
- sys.exit()
|