带有Postgresql的Python Cgi错误消息:头之前的脚本输出结束:custo

帮助错误消息:头之前的脚本输出结束:customer_add.py

选择 | 换行 | 行号
  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"

标签: python

添加新评论