# import pymysql.cursors import pymysql # Connect to the database # connection = pymysql.connect(host="sql25.phpnet.org", # user="msb77833", # password="GLSb0uhU5W3E", # db="msb77833", # charset="utf8mb4", # cursorclass=pymysql.cursors.DictCursor) connection = pymysql.connect( host="sql25.phpnet.org", user="msb77833", password="GLSb0uhU5W3E", db="msb77833") # if connection.is_connected(): db_Info = connection.get_server_info() print("Connected to MySQL Server version ", db_Info) cursor = connection.cursor() cursor.execute("select database();") record = cursor.fetchone() print("You're connected to database: ", record) print() # cursor = connection.cursor() # SQL # sql = "SELECT * FROM t_mouvement" # sql = "SELECT Valeur actuelle FROM ##Global action'" # Execute query. cursor.execute("SELECT * FROM t_mouvement;") result = cursor.fetchall() print("cursor.description: ", cursor.description) for x in result: print(x) # Close connection. connection.close() print()