#!/usr/bin/python
# e begoli, python connector for mysql
# import MySQL module
import MySQLdb
# connect
db = MySQLdb.connect(host = "localhost", user = "adamplo1", passwd = "U7RJM5HQ", db = "adamplo1_UniProject")
# create a database cursor
cursor = db.cursor()
# execute SQL select statement
cursor.execute("SELECT * FROM User")
# get the number of rows in the resultset
numrows = int(cursor.rowcount)
# get and display one row at a time
for x in range(0,numrows):
row = cursor.fetchone()
print row[0], "-->", row[1]
is there any error with the above script. I am running the scrip on an external hosting and you can see what i get here http://adamplowman.com/cgi-bin/database.py.
I am new to python and would appreciate any help