PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '))' at line 1: DELETE FROM {quiz_multichoice_user_answer_multi} WHERE (user_answer_id IN ()) ; Array ( ) in MultichoiceQuestion->delete() (line 317 of /tdtg/quiz-d7/web/sites/all/modules/quiz/question_types/multichoice/multichoice.classes.inc).

A fix that works for me:

    if($user_answer_id)
      db_delete('quiz_multichoice_user_answer_multi')
        ->condition('user_answer_id', $user_answer_id, 'IN')
        ->execute();

Comments

sivaji_ganesh_jojodae’s picture

Status: Active » Fixed

Added a check to fix that and committed the code to git. Thanks.

w3father’s picture

I am getting same error in my site quiz module Learn english. Please say where to add this code on library module.

Nikolaus H’s picture

Thanks for your Input.

If your running Xampp:
C:\xampp\htdocs\drupal\sites\all\modules\quiz\question_types\multichoice\multichoice.classes.inc

If your installation is running on a Webserver you have to find the drupal installation and then
\drupal\sites\all\modules\quiz\question_types\multichoice\multichoice.classes.inc

Search for the String: db_delete('quiz_multichoice_user_answer_multi')
You'll fint it in line 316. Add if($user_answer_id) in the line before, as RaceCorp mentioned above.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

rich.yumul’s picture

Worked for me!

borgewarvik’s picture

Priority: Normal » Major
Status: Closed (fixed) » Needs work

We also had this issue. This fix worked for us.

reszli’s picture

StatusFileSize
new1006 bytes

here's a quick patch for the above

dsdeiz’s picture

diff --git a/sites/all/modules/contrib/quiz/question_types/multichoice/multichoice.classes.inc b/sites/all/modules/contrib/quiz/question_types/multichoice/multichoice.classes.inc
index b5d92f1..cf880d2 100755
--- a/sites/all/modules/contrib/quiz/question_types/multichoice/multichoice.classes.inc

Patch cannot be applied due to the path.

sivaji_ganesh_jojodae’s picture

Status: Needs work » Fixed

The fix is also available for download from here http://hub.knackforge.com/projects/quiz-support/files

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

luf’s picture

Applied patch and fixed the error, this has not yet been commited to the current revision that is available for download. Please commit this patch as quickly as possible this is a major issue for those who are unable to understand the modifications required to fix the issue.

luf’s picture

Issue summary: View changes

Oops!

  • Commit d2fe039 on 7.x-4.x, 7.x-5.x by sivaji:
    Issue #1936666 by RaceCorp: Fixed Error when deleting a multichoice...

  • Commit d2fe039 on 7.x-4.x, 7.x-5.x, quiz-pages by sivaji:
    Issue #1936666 by RaceCorp: Fixed Error when deleting a multichoice...

  • Commit d2fe039 on 7.x-4.x, 7.x-5.x, quiz-pages, 2269219 by sivaji:
    Issue #1936666 by RaceCorp: Fixed Error when deleting a multichoice...

  • Commit d2fe039 on 7.x-4.x, 7.x-5.x, 2269219 by sivaji:
    Issue #1936666 by RaceCorp: Fixed Error when deleting a multichoice...