I have been working with code for hours and just cannot see where I have an error. This is the offending code
$answercreatequery = pg_query("INSERT INTO answer (answerid, questionid, adescription, afilelocation, iscorrect) VALUES( default, '".$thisquestionid."', '".$adescription1."', '".$afilelocation."', '".$iscorrect1."' ");
And this is the error reported
Warning: pg_query() [function.pg-query]: Query failed: ERROR: syntax error at end of input LINE 1: ...on, iscorrect) VALUES( default, '37', 'kyfhdkj', 'none', '' ^ in /ceri/homes1/m/mtp4/public_html/mmp/Quizmaker/Clientside/questioncreatescript.php on line 167
I am wondering if there is something simple I am missing? I have suspected it was because $iscorrect1 is type boolean and I have tried editing it in many ways but still I get the same kind of error.
/d answer table
Column | Type | Modifiers
---------------+------------------------+-----------------------------------------------------------
answerid | integer | not null default nextval('answer_answerid_seq'::regclass)
questionid | integer | not null
adescription | character varying(200) | not null
afilelocation | character varying(200) | not null
iscorrect | boolean | not null
Indexes:
"answer_pkey" PRIMARY KEY, btree (answerid)
Foreign-key constraints:
"answer_questionid_fkey" FOREIGN KEY (questionid) REFERENCES question(questionid)
$adescription1
,$afilelocation
, etc. until you discover which of the four is the offender. It looks like it's probably$iscorrect1
, so maybe try hard-coding that and see if the problem goes away. – Jason Swett Jan 27 '13 at 12:41\d answer
in your question might be helpful. – Jason Swett Jan 27 '13 at 12:42