Return-Path: owner-postman
Received: from localhost.Berkeley.EDU (localhost.Berkeley.EDU [127.0.0.1]) by nobozo.CS.Berkeley.EDU (8.6.10/8.6.3) with SMTP id VAA10394 for postgres-redist; Mon, 10 Jul 1995 21:06:37 -0700
Resent-From: POSTGRES mailing list <postman@postgres.Berkeley.EDU>
Resent-Message-Id: <199507110406.VAA10394@nobozo.CS.Berkeley.EDU>
X-Authentication-Warning: nobozo.CS.Berkeley.EDU: Host localhost.Berkeley.EDU didn't use HELO protocol
Sender: owner-postman@postgres.Berkeley.EDU
X-Return-Path: owner-postman
Received: from tristero.io.com (tristero.io.com [199.170.88.11]) by nobozo.CS.Berkeley.EDU (8.6.10/8.6.3) with ESMTP id VAA10384 for <postgres@nobozo.CS.Berkeley.EDU>; Mon, 10 Jul 1995 21:06:35 -0700
Received: from dialup-219.austin.io.com (dialup-219.austin.io.com [199.170.90.41]) by tristero.io.com (8.6.12/8.6.12) with SMTP id XAA24519 for <postgres@nobozo.CS.Berkeley.EDU>; Mon, 10 Jul 1995 23:06:12 -0500
Date: Mon, 10 Jul 1995 23:06:12 -0500
Message-Id: <199507110406.XAA24519@tristero.io.com>
X-Sender: mskc@io.com
Mime-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
To: postgres@postgres.Berkeley.EDU
From: mskc@io.com (Casey Claiborne)
Subject: NCSA and postgres dont like each other 
X-Mailer: <PC Eudora Version 1.4>
Resent-To: postgres-redist@postgres.Berkeley.EDU
Resent-Date: Mon, 10 Jul 95 21:06:37 -0700
Resent-XMts: smtp

Hello everyone-
	I am currently using a postgres database with a NCSA httpd server.
I thought that everything was OK until I ran this piece of code below.
What is happening is as follows:

1) HTML form is displayed
2) press "submit" button on HTML form
3) cgi-srcipt takes data fromt the form
4) data from the form is sent to routine listed below for placement
	into database.
5) at the point when either 'PQexec("end")' or 'PQfinish()' are executed,
	the NCSA server screen is displayed with an error code of 500.


Problem is:
	This database routine works just fine by itself - if I take the
code below, place it into a C routine, compile and run it, I have no
problems at all. Everything happens as it should - information goes into the=
 db.
After some troubleshooting, I have found that the error occurs when either
of the following are executed: PQexec("end") OR PQfinish()

Question is:
	Why is this happening? My goal is to take data from an HTML form
and place it into the postgres database. I would like to accomplish
this from C code. Below is the way that I have approaced the problem.
Is there a better way to do this because obviously, the approch below
does not work.

Does anyone have any suggestions?

Casey =3D> mskc@io.com=7F

....

sprintf(final,  "append (ccnamelast =3D \"%s\", ccnamemiddle =3D \'%c\',=20
ccnamefirstp =3D \"%s\" ",
	  customerinfo -> ccnamelast,
          customerinfo -> ccnamemiddle,
          customerinfo -> ccnamefirstp);

PQsetdb("DB");
PQexec("begin");=7F
res =3D PQexec(final);
if (*res =3D=3D 'I' )
	{
	printf("non-fatal error occurred ");
	PQexec("end"); <=3D causes an error with NCSA server
	return FATAL_ERROR;
	}
if (*res =3D=3D 'E' )
	{
	printf("fatal error occurred");
	PQexec("end"); <=3D causes an error with NCSA server
	return NON_FATAL_ERROR;
	}
PQexec("end"); <=3D causes error with NCSA server
PQfinish();
return SUCCESS;
}
Casey Claiborne mskc@io.com

One must note the importance of setting reasonable and achievable goals for
                    "If you aim for nothing, you'll hit it every time"=20


==============================================================================
   To add/remove yourself to/from the POSTGRES mailing list: send mail with 
   the subject line ADD or DEL to "postgres-request@postgres.Berkeley.EDU".
   If this fails, send mail to "post_questions@postgres.Berkeley.EDU" and
   a human will deal with it.  DO NOT post to the "postgres" mailing list.
==============================================================================
              URL: http://s2k-ftp.CS.Berkeley.EDU:8000/postgres/
