[Tutor] Python + MySQL , my first simple program does not gives results

John Joseph jjk_saji at yahoo.com
Thu Jan 19 13:46:12 CET 2006


Hi  
   I  tried out my first Pyhton program with MySQL 
             I was trying to get the  some result , eg
 describe table, select * from table
   but my program does not give the expected results ,
 nor it gives any error 
                 I am adding  my code in this mail 
                 Please guide me , why I am not
getting  any results displayed 
                                 Thanks 
                                       Joseph John 
*******************************************************************************8


"""  For learning for
         To connect to a database "learnpython" , with
mysql user name "john" password "asdlkj"
         To describe a table "contact"
         To get result of  SQL statement

"""


import MySQLdb
class learnpython_db:
        def __init__(self):
                db =
MySQLdb.connect(host="localhost",user =
"john",password = "asdlkj", db = learnpython)
                cursor = db.cursor()
                cursor.execute(" describe contact" )
                cursor.execute(" SELECT * from
contact" )





	
	
		
___________________________________________________________ 
Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with voicemail http://uk.messenger.yahoo.com


More information about the Tutor mailing list