I can't seem to save answers for questions because when it tries to insert into the 'pe_quiz_question_answer' table, it's using NULL as the value for the 'aid' column.

An example from pe_multichoice.module:

db_query("INSERT INTO {pe_quiz_question_answer} (aid, question_nid, answer, feedback, points) VALUES(%d, %d, '%s', '%s', %d)",
NULL, $node->nid, $value['answer'], $value['feedback'], $value['correct']);

I'm using postgreSQL, so maybe it's a difference between mysql and pgsql in that a it would create the next incremented value. But otherwise I'm not sure what it's supposed to be doing.

Can someone clear this up?

Comments

dakala’s picture

Sorry, I haven't done any testing on PostgreSQL but I suspect it has to do with your observation. You could try this:

db_query("INSERT INTO {pe_quiz_question_answer} (question_nid, answer, feedback, points) VALUES(%d, '%s', '%s', %d)",
$node->nid, $value['answer'], $value['feedback'], $value['correct']);