Skip to content

Commit

Permalink
fixed value labels
Browse files Browse the repository at this point in the history
git-svn-id: file:///Users/Shitiz/Downloads/lssvn/source/phpsurveyor@2186 b72ed6b6-b9f8-46b5-92b4-906544132732
  • Loading branch information
Ronald Leenes committed Dec 14, 2006
1 parent 687a62b commit 7443997
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions admin/spss.php
Expand Up @@ -70,7 +70,8 @@
$fields=array();
}

$fieldno=1;
//$fieldno=1;
$fieldno=0;
$tempArray = array();
$query="SHOW COLUMNS FROM ".db_table_name("survey_$surveyid");
$result=db_execute_assoc($query) or die("Couldn't count fields<br />$query<br />".$connect->ErrorMsg());
Expand All @@ -83,15 +84,15 @@
# - Length may not be longer than 8 characters
# - Name may not begin with a digit
$fieldname = $row["Field"];

//echo $fieldname." - ";
#Rename 'datestamp' to stamp
if ($fieldname =="datestamp") {
$fieldname = "stamp";
}


#Determine field type
if ($fieldname=="stamp"){
if ($fieldname=="stamp" || $fieldname=="submitdate" || $fieldname=="datestamp"){
$fieldtype = "DATETIME20.0";
} else {
if (isset($fieldname) && $fieldname != "")
Expand Down Expand Up @@ -187,7 +188,6 @@

//echo "*Begin data\n";
echo "BEGIN DATA\n";//minni"<br />";
$tokensexist=0;
if (isset($tokensexist) && $tokensexist == 1 && $surveyprivate == "N") {
$query="SELECT {$dbprefix}tokens_$surveyid.firstname ,
{$dbprefix}tokens_$surveyid.lastname ,
Expand All @@ -202,7 +202,8 @@
FROM {$dbprefix}survey_$surveyid
LEFT JOIN {$dbprefix}tokens_$surveyid ON {$dbprefix}survey_$surveyid.token = {$dbprefix}tokens_$surveyid.token";
} else {
$query = "SELECT {$dbprefix}survey_$surveyid.*
//$query = "SELECT {$dbprefix}survey_$surveyid.*
$query = "SELECT *
FROM {$dbprefix}survey_$surveyid";
}

Expand All @@ -211,9 +212,12 @@
$num_results = $result->RecordCount();
$num_fields = $result->FieldCount();
for ($i=0; $i < $num_results; $i++) {

$row = $result->FetchRow();
$fieldno = 0;
while ($fieldno < $num_fields){

//echo " field: ".$fields[$fieldno]["id"]." id : ".$fields[$fieldno]["qid"]." val:".$row[$fieldno]."-type: ".$fields[$fieldno]["type"]." |<br> ";
if ($fieldno % 20 == 0) echo chr(65+intval($fieldno/20))." ";
//if ($i==0) { echo "Field: $fieldno - Dati: ";var_dump($fields[$fieldno]);echo "\n"; }
if ($fields[$fieldno]["type"]=="DATETIME20.0"){
Expand Down Expand Up @@ -333,8 +337,10 @@
}
if ($field['ftype'] == "F")
{
$displayvaluelabel = 0;
$query = "SELECT {$dbprefix}questions.lid, {$dbprefix}labels.code, {$dbprefix}labels.title from
{$dbprefix}questions, {$dbprefix}labels WHERE {$dbprefix}labels.language='".$language."' and
{$dbprefix}questions.language='".$language."' and
{$dbprefix}questions.qid ='".$field["qid"]."' and {$dbprefix}questions.lid={$dbprefix}labels.lid";
$result=db_execute_assoc($query) or die("Couldn't get labels<br />$query<br />".$connect->ErrorMsg());
$num_results = $result->RecordCount();
Expand Down

0 comments on commit 7443997

Please sign in to comment.