2
0
mirror of https://github.com/ACSPRI/queXS synced 2024-04-02 12:12:16 +00:00

Removed reliance on next() which is unreliable

This commit is contained in:
azammitdcarf
2009-02-16 05:34:04 +00:00
parent 49bf38f5b9
commit 6788638d68

View File

@@ -518,11 +518,15 @@ function limesurvey_export_fixed_width($questionnaire_id,$sample_import_id = fal
if ($sample_import_id == false) if ($sample_import_id == false)
{ {
$sql .= " AND ("; $sql .= " AND (";
$ccount = count($r);
$ccounter = 0;
foreach($r as $row) foreach($r as $row)
{ {
$token = $row['case_id']; $token = $row['case_id'];
$ccounter++;
$sql .= " token = '$token'"; $sql .= " token = '$token'";
if (next($r)) $sql .= " or "; if ($ccounter < $ccount)
$sql .= " or ";
} }
$sql .= ")"; $sql .= ")";
} }
@@ -539,11 +543,15 @@ function limesurvey_export_fixed_width($questionnaire_id,$sample_import_id = fal
if (!empty($r)) if (!empty($r))
{ {
$sql .= " AND ("; $sql .= " AND (";
$ccount = count($r);
$ccounter = 0;
foreach($r as $row) foreach($r as $row)
{ {
$token = $row['case_id']; $token = $row['case_id'];
$ccounter++;
$sql .= " token = '$token'"; $sql .= " token = '$token'";
if (next($r)) $sql .= " or "; if ($ccounter < $ccount)
$sql .= " or ";
} }
$sql .= ")"; $sql .= ")";
} }
@@ -551,7 +559,7 @@ function limesurvey_export_fixed_width($questionnaire_id,$sample_import_id = fal
} }
$r = $ldb->GetAll($sql); $r = $ldb->GetAll($sql);
foreach($r as $Row) foreach($r as $Row)
{ {
foreach ($varwidth as $var => $width) foreach ($varwidth as $var => $width)