[DB-SIG] alo

William Dode wilk-ml@flibuste.net
11 Mar 2003 10:44:48 +0100


"Gerardo Rodriguez Gutierrez" <grg@itesm.mx> writes:

>  Do you have code example for basing me? I need to connect to MySQL and
> display it into a html table by colums and rows.

import MySQLdb
db=3DMySQLdb.connect(db=3D"cci",host=3D"localhost",user=3D"me",passwd=3D"")
cursor=3Ddb.cursor()
cursor.execute("select id_adherent,nom from cci_adherent")
print "<table>"
for row in cursor.fetchall():
   print "<tr><td>%s</td><td>%s</td></tr>"%(row[0],row[1])
print "</table>"

--=20
William Dod=E9 - http://flibuste.net