Thread Rating:
  • 0 Vote(s) - 0 Average
[help]how to print row table mysql to xbmcgui
#1
anyone can tell me how can i print row table mysql on xbmcgui ? i have table like this :


import MySQLdb as mdb
import sys

try:
conn = mdb.connect('192.168.200.16', 'ivan', 'ivan123', 'ivan');

cursor = conn.cursor()
cursor.execute("CREATE TABLE IF NOT EXISTS \
nama(Id INT PRIMARY KEY AUTO_INCREMENT, Name VARCHAR(25))")
cursor.execute("INSERT INTO nama(Name) VALUES('suginto')")
cursor.execute("INSERT INTO nama(Name) VALUES('ivan')")
cursor.execute("INSERT INTO nama(Name) VALUES('alif')")
cursor.execute("INSERT INTO nama(Name) VALUES('sukoco')")
cursor.execute("INSERT INTO nama(Name) VALUES('supiandi')")

conn.commit()

cursor.close()
conn.close()

except mdb.Error, e:

print "Error %d: %s" % (e.args[0],e.args[1])
sys.exit(1)


when i print on python :

python panggil.py
(1L, 'yulianto')
(2L, 'ivan')
(3L, 'alif')
(4L, 'sukoco')
(5L, 'supiandi')

this is the code from panggil.py :

import MySQLdb as mdb
import sys


con = mdb.connect('192.168.200.16', 'ivan', 'ivan123', 'ivan');

with con:

cur = con.cursor()
cur.execute("SELECT * FROM nama")

rows = cur.fetchall()

for row in rows:
print row



anyone can give me some suggestion for this case ? what step i must doing for calling mysql table information to xbmcgui like button , input text ? i use dharma version.
Reply
 
Thread Rating:
  • 0 Vote(s) - 0 Average



Logout Mark Read Team Forum Stats Members Help
[help]how to print row table mysql to xbmcgui00