View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
04898 | Bug reports | Other | public | 2011-01-24 15:05 | 2011-02-17 18:25 |
Reporter | jacopo | Assigned To | texens | ||
Priority | normal | Severity | partial_block | ||
Status | closed | Resolution | fixed | ||
Product Version | 1.91RC2 | ||||
Target Version | 1.91RC4 | Fixed in Version | 1.91RC4 | ||
Summary | 04898: Cannot delete individual answers [PATCH] | ||||
Description | When I try to delete an individual answer to a survey, I get a SQL error (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 'FROM I believe the bug lies around line 370 in browse.php: I think the script should also check if $fuqtquestions is empty or not. I attach a patch against the latest SVN (9712). | ||||
Steps To Reproduce |
| ||||
Tags | No tags attached. | ||||
Attached Files | patch-deleteanswer.patch (1,824 bytes)
Index: admin/browse.php =================================================================== --- admin/browse.php (revision 9712) +++ admin/browse.php (working copy) @@ -367,19 +367,21 @@ $fuqtquestions[] = $field['fieldname']; } - // find all responses (filenames) to the fuqt questions - $query="SELECT " . implode(", ", $fuqtquestions) . " FROM $surveytable where id={$_POST['deleteanswer']}"; - $responses = db_execute_assoc($query) or safe_die("Could not fetch responses<br />$query<br />".$connect->ErrorMsg()); + if (!empty($fuqtquestions)) { + // find all responses (filenames) to the fuqt questions + $query="SELECT " . implode(", ", $fuqtquestions) . " FROM $surveytable where id={$_POST['deleteanswer']}"; + $responses = db_execute_assoc($query) or safe_die("Could not fetch responses<br />$query<br />".$connect->ErrorMsg()); - while($json = $responses->FetchRow()) - { - foreach ($fuqtquestions as $fieldname) + while($json = $responses->FetchRow()) { - $phparray = json_decode($json[$fieldname]); - foreach($phparray as $metadata) + foreach ($fuqtquestions as $fieldname) { - $path = dirname(getcwd())."/upload/surveys/".$surveyid."/files/"; - unlink($path.$metadata->filename); // delete the file + $phparray = json_decode($json[$fieldname]); + foreach($phparray as $metadata) + { + $path = dirname(getcwd())."/upload/surveys/".$surveyid."/files/"; + unlink($path.$metadata->filename); // delete the file + } } } } | ||||
Bug heat | 4 | ||||
Complete LimeSurvey version number (& build) | 9712 | ||||
I will donate to the project if issue is resolved | No | ||||
Browser | |||||
Database type & version | MySQL 5.1.49 | ||||
Server OS (if known) | Ubuntu 10.10 | ||||
Webserver software & version (if known) | Apache 2.2.16 | ||||
PHP Version | 5.3.3 | ||||
Texens, please verify the patch and apply it accrodingly because the issue is caused by FUQT code. Thank you! |
|
Fixed in r9741. |
|
1.91RC4 released |
|
Date Modified | Username | Field | Change |
---|---|---|---|
2011-01-24 15:05 | jacopo | New Issue | |
2011-01-24 15:05 | jacopo | File Added: patch-deleteanswer.patch | |
2011-01-26 23:39 | c_schmitz | Assigned To | => texens |
2011-01-26 23:39 | c_schmitz | Status | new => assigned |
2011-01-26 23:40 | c_schmitz | Note Added: 13986 | |
2011-02-01 16:15 | mdekker | Target Version | => 1.91RC4 |
2011-02-03 16:36 | texens | Note Added: 14048 | |
2011-02-03 16:36 | texens | Status | assigned => resolved |
2011-02-03 16:36 | texens | Fixed in Version | => 1.91RC4 |
2011-02-03 16:36 | texens | Resolution | open => fixed |
2011-02-17 18:25 | c_schmitz | Note Added: 14236 | |
2011-02-17 18:25 | c_schmitz | Status | resolved => closed |