Skip to content

Commit

Permalink
Fixed CDbCommand "Syntax error or access violation" when inserting a …
Browse files Browse the repository at this point in the history
…single quote
  • Loading branch information
madflow committed Sep 2, 2013
1 parent 61c07ba commit 18dda0f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions application/controllers/survey/index.php
Expand Up @@ -602,8 +602,8 @@ function sendreq(surveyid)
if (!isset($_SESSION['survey_'.$surveyid]['srid']) && $thissurvey['anonymized'] == "N" && $thissurvey['active'] == "Y" && isset($token) && $token !='')
{
// load previous answers if any (dataentry with nosubmit)
$sQuery="SELECT id,submitdate,lastpage FROM {$thissurvey['tablename']} WHERE {$thissurvey['tablename']}.token='{$token}' order by id desc";
$aRow = Yii::app()->db->createCommand($sQuery)->queryRow();
$sQuery="SELECT id,submitdate,lastpage FROM {$thissurvey['tablename']} WHERE {$thissurvey['tablename']}.token=:token order by id desc";
$aRow = Yii::app()->db->createCommand($sQuery)->bindValues(array(':token' => $token))->queryRow();
if ( $aRow )
{
if(($aRow['submitdate']=='' && $thissurvey['tokenanswerspersistence'] == 'Y' )|| ($aRow['submitdate']!='' && $thissurvey['alloweditaftercompletion'] == 'Y'))
Expand Down

0 comments on commit 18dda0f

Please sign in to comment.