ronin
Окт. 14, 2008 14:48:50
Питон знаю плохо, учу сам осваиваю, ошибки выдает. Вот сам код:
#!/usr/bin/python
# -*- coding: Windows-1251 -*-
import MySQLdb
print “Content-Type: text/html”
print
print “<html><head><title>Журнал заявок</title></head>”
print “<body>”
print “<h1>7777</h1>”
print “<ul>”
connection = MySQLdb.connect(user='root', passwd='root', db='problem',
host=“192.168.8.0”)
connection.query(“SET NAMES ‘cp1251’”)
cursor = connection.cursor()
cursor.execute(“SET NAMES ‘cp1251’”)
cursor.execute(“SELECT ulica FROM problem ORDER BY id DESC LIMIT 5”)
resultset = cursor.fetchall()
for row in resultset:
for c in row:
print “<li>%s</li>” %c
print “</ul>”
print “</body></html>”
connection.close()
—————————