Python Cgi with Postgresql Error message: End of script output before headers: custo

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hutchinsmitch
    New Member
    • Aug 2014
    • 1

    Python Cgi with Postgresql Error message: End of script output before headers: custo

    help!!
    Error message: End of script output before headers: customer_add.py
    Code:
    import psycopg2
    
    con = None
    import cgi;
    data = cgi.FieldStorage();
    
    try:
        customer_id = data['customer_id'].value
        customer_lname = data['customer_lname'].value;
        customer_fname = data['customer_fname'].value;
        customer_mname = data['customer_mname'].value;
        customer_birthday = data['customer_birthday'].value;
        customer_email = data['customer_email'].value;
        customer_contact = data['customer_contact'].value;
        customer_address = data['customer_address'].value;
        customer_job = data['customer_job'].value;
        customer_company = data['customer_company'].value;
        customer = (
    	(customer_id, customer_lname , customer_fname , customer_mname , 
    
    customer_birthday, customer_email , customer_contact, customer_address, 
    
    customer_job, customer_company)
        )
        con = psycopg2.connect(database='fhms', user='admin', password='admin')
        cur = con.cursor()
        query = """INSERT INTO t_customer(customer_id, customer_lname, 
    
    customer_fname, customer_mname, customer_birthday, customer_email, 
    
    customer_contact, customer_address, customer_job, customer_company) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)"""
    	cur.execute(query, customer)
    
        con.commit()
        print "Customer Successfully Added"
    Last edited by bvdet; Aug 26 '14, 03:40 PM. Reason: Add code tags
Working...