By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,337 Members | 2,084 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,337 IT Pros & Developers. It's quick & easy.

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

P: 1
help!!
Error message: End of script output before headers: customer_add.py
Expand|Select|Wrap|Line Numbers
  1. import psycopg2
  2.  
  3. con = None
  4. import cgi;
  5. data = cgi.FieldStorage();
  6.  
  7. try:
  8.     customer_id = data['customer_id'].value
  9.     customer_lname = data['customer_lname'].value;
  10.     customer_fname = data['customer_fname'].value;
  11.     customer_mname = data['customer_mname'].value;
  12.     customer_birthday = data['customer_birthday'].value;
  13.     customer_email = data['customer_email'].value;
  14.     customer_contact = data['customer_contact'].value;
  15.     customer_address = data['customer_address'].value;
  16.     customer_job = data['customer_job'].value;
  17.     customer_company = data['customer_company'].value;
  18.     customer = (
  19.     (customer_id, customer_lname , customer_fname , customer_mname , 
  20.  
  21. customer_birthday, customer_email , customer_contact, customer_address, 
  22.  
  23. customer_job, customer_company)
  24.     )
  25.     con = psycopg2.connect(database='fhms', user='admin', password='admin')
  26.     cur = con.cursor()
  27.     query = """INSERT INTO t_customer(customer_id, customer_lname, 
  28.  
  29. customer_fname, customer_mname, customer_birthday, customer_email, 
  30.  
  31. customer_contact, customer_address, customer_job, customer_company) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)"""
  32.     cur.execute(query, customer)
  33.  
  34.     con.commit()
  35.     print "Customer Successfully Added"
Aug 25 '14 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.