Python ile MYSQL den veri sorgulatmak

[code]""" Python to MySQL using mysql-python from Sourceforge
at http://prdownloads.sourceforge.net/mysql-python

This is a very simple demonstration of the Python to
MySQL interface downloaded and installed from the above
address.

If you have a database and table already set up for test
purposes, you should be able to adopt this code to work.

"""

import _mysql

db=_mysql.connect(host="192.168.200.66",user="trainee",
passwd="abc123",db="forsale")

db.query("""SELECT agent, street, town, phone FROM agents""")
r = db.store_result()

while 1:
row = r.fetch_row()
if not row: break
print row

note = """

Note - issues that may arise:

1. MySQL version dependencies and supported versions.
See distribution for full details but you may need to
export mysqlclient=mysqlclient
if you don't have the threadsafe libraries.

2. If you have older libraries / newer MySQL, you may
need to set old_password - see link from
http://www.wellho.net/mouth/515_MySQL-an-FAQ.html

3. You need the Python development environment installed
in order to load the MySQL / Python drivers.

4. store_result pulls back the whole result set internally
and you may prefer to call up use_result instead

"""[/code]
Hanci.org sizlere daha iyi hizmet sunmak için çerezleri kullanıyor.
Hanci.org sitesini kullanarak çerez politikamızı kabul etmiş olacaksınız.
Detaylı bilgi almak için Gizlilik ve Çerez Politikası metnimizi inceleyebilirsiniz.