also ich habe mich heute nochmal mit all diesen Sachen auseinandergesetzt und komm leider nicht viel weiter, da er mir immer einen Internal Server Error anzeigt...
Code: Alles auswählen
#!/usr/bin/python
import cgi
print "Content-Type: text/html\n"
import _mysql
db = _mysql.connect("localhost","johannes","123123123","johannes")
#alles darüber funktioniert, ab der nächsten Zeile zeigt er mir jedes mal einen Fehler
cursor = db.cursor()
cursor.execute("SELECT a FROM test")
qwe = cursor.fetchone()
wer = cursor.fetchall()
cursor.close()
db.close()
Problem: Leider steht es in jedem Beispiel aber so drin?! Wenn der Verbindung zur Datenbank schon nicht funktionieren würde, dann bekäme ich ja schon eine Fehlermeldung, oder? Also kanns an der nicht liegen... Weiter kenn ich mich leider nicht besser aus. Was mache ich falsch?
vllt. hilft ja ein errorlog:
Code: Alles auswählen
[Wed Nov 07 16:27:31 2007] [error] [client 1] PythonHandler mod_python.cgihandler: AttributeError: cursor
[Wed Nov 07 16:27:32 2007] [error] [client 1] PythonHandler mod_python.cgihandler: Traceback (most recent call last):
[Wed Nov 07 16:27:32 2007] [error] [client 1] PythonHandler mod_python.cgihandler: File "/usr/lib/python2.4/site-packages/mod_python/apache.py", line 299, in HandlerDispatch\n result = object(req)
[Wed Nov 07 16:27:32 2007] [error] [client 1] PythonHandler mod_python.cgihandler: File "/usr/lib/python2.4/site-packages/mod_python/cgihandler.py", line 96, in handler\n imp.load_module(module_name, fd, path, desc)
[Wed Nov 07 16:27:32 2007] [error] [client 1] PythonHandler mod_python.cgihandler: File "/srv/www/vhosts/icoost.com/httpdocs/python.py", line 8, in ?\n cursor = db.cursor()
[Wed Nov 07 16:27:32 2007] [error] [client 1] PythonHandler mod_python.cgihandler: AttributeError: cursor