[help]how to print row table mysql to xbmcgui

  Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
rushit Offline
Junior Member
Posts: 6
Joined: Sep 2011
Reputation: 0
Post: #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.
find quote