I am trying to set a cookie but when i check my browser cookies nothing is set. What am doing wrong

# e begoli, python connector for mysql
# import MySQL module
import MySQLdb
import cgi
import Cookie
import time
cookie = Cookie.SimpleCookie()
cookie["ID"] = ""
print "Content-type: text/html\n"

# connection
db = MySQLdb.connect(host = "dsfdsfdsfsdf", user = "sdfsdfsdfsdf", passwd = "sdfsdfsdfdsfds", db = "dsfdsfdsfdsf")

form = cgi.FieldStorage()
if form.has_key("username")and form["username"].value !="" and form.has_key("password") and form["password"].value !="":
    username = form["username"].value
    password = form["password"].value
    # create a database cursor
    cursor = db.cursor(MySQLdb.cursors.DictCursor)

    # execute SQL select statement
    cursor.execute("SELECT * FROM User WHERE UserName = username AND Password = PASSWORD('"+password+"')")

    # get the number of rows in the resultset
    numrows = int(cursor.rowcount)

    if numrows ==0:
        print "<meta http-equiv=\"refresh\" content=\"0;url=http://adamplowman.com/uni_project/login.html\">"
        Results = cursor.fetchall()
        for subelement in Results[0].keys():
            if subelement == "Id":
                ID = int(Results[0][subelement])
        # get the number of rows in the resultset
        numrows = int(cursor.rowcount)  
        cookie["ID"] = ID
        print "<meta http-equiv=\"refresh\" content=\"0;url=http://adamplowman.com/uni_project/main.html\">"
9 Years
Discussion Span
Last Post by adam291086

solved it by just using this line

print 'Set-Cookie: lastvisit=' + str(time.time());

instead of using the cookiee module

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.