View Issue Details

This bug affects 1 person(s).
 8
IDProjectCategoryView StatusLast Update
04894Bug reportsResponse browsingpublic2011-01-26 22:10
Reporterstarmonkey Assigned ToDenisChenu  
PriorityhighSeverityblock 
Status closedResolutionfixed 
Product Version1.91RC2 
Fixed in Version1.91RC3 
Summary04894: Changing "display" to "Completed responses only" = SQL syntax error
Description

As per the summary. Admin cannot proceed once this issue is triggered.

Steps To Reproduce

1) Go to browse a survey's responses
2) Change display to "completed responses only"
3) System fails with an SQL error that's not recoverable:

Couldn't pull response data
SELECT count(*) FROM lime_survey_18513 submitdate IS NOT NULL
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 'IS NOT NULL' at line 1

Additional Information

I fixed it by adding a line to admin/browse.php:

$sql_where = "";
if (incompleteAnsFilterstate() == "inc")
{
$sql_where .= "submitdate IS NULL";
}
elseif (incompleteAnsFilterstate() == "filter")
{
$sql_where .= "submitdate IS NOT NULL";
}

// SM 22Jan11: Fix to add WHERE clause if needed.
if($sql_where != "") { $sql_where = "WHERE ".$sql_where; }

//LETS COUNT THE DATA
$dtquery = "SELECT count(*) FROM $sql_from $sql_where";

$dtresult=db_execute_num($dtquery) or safe_die("Couldn't pull response data<br />{$dtquery}<br />".$connect->ErrorMsg());

I generally prefer generating sql in more robust methods, but that's my quick fix.

TagsNo tags attached.
Bug heat8
Complete LimeSurvey version number (& build)191
I will donate to the project if issue is resolvedNo
BrowserFirefox, Chrome
Database type & versionMySQL5
Server OS (if known)Ubuntu 10.04
Webserver software & version (if known)Apache2
PHP VersionPHP5

Relationships

related to 04929 closedlemeur crash by pressing "show answers" in "answers and statistics" 

Users monitoring this issue

DenisChenu

Activities

starmonkey

starmonkey

2011-01-22 09:12

reporter   ~13954

Note the build is Version 1.91RC2 Build 9672 (latest download)

DenisChenu

DenisChenu

2011-01-22 19:01

developer   ~13957

Thanks !

Fixed with:
if ($sql_where!="")
{
$dtquery .=" WHERE $sql_where";
}

:)

http://limesurvey.svn.sourceforge.net/viewvc/limesurvey?view=revision&amp;revision=9711

c_schmitz

c_schmitz

2011-01-26 22:10

administrator   ~13968

Released.

Issue History

Date Modified Username Field Change
2011-01-22 08:47 starmonkey New Issue
2011-01-22 09:12 starmonkey Note Added: 13954
2011-01-22 18:55 DenisChenu Assigned To => DenisChenu
2011-01-22 18:55 DenisChenu Status new => assigned
2011-01-22 18:58 DenisChenu Status assigned => resolved
2011-01-22 18:58 DenisChenu Fixed in Version => 1.91RC3
2011-01-22 18:58 DenisChenu Resolution open => fixed
2011-01-22 18:59 DenisChenu Issue Monitored: DenisChenu
2011-01-22 19:01 DenisChenu Note Added: 13957
2011-01-26 22:10 c_schmitz Note Added: 13968
2011-01-26 22:10 c_schmitz Status resolved => closed
2011-03-01 11:58 DenisChenu Relationship added related to 04929
2021-08-03 07:27 guest Bug heat 6 => 8