Browse Source

Initial commit

Julien Rabier 13 years ago
commit
4b74765487
1 changed files with 21 additions and 0 deletions
  1. 21 0
      adhcount.py

+ 21 - 0
adhcount.py

@@ -0,0 +1,21 @@
+#!/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")
+
+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()
+