• I’ve been running Survey Creator (https://www.instinct.co.nz/?p=11)…

    I’ve had it running on my WordPress blog for a few weeks, yet I hadn’t downloaded the results or the comments from the survey. I did that this morning and I’m getting error messages throughout the csv files that I download. no information from the survey, just error messages.

    <b>Warning</b>: Invalid argument supplied for foreach() in <b>/home/.kafka/rtfldgr/blog.zimmermann2006.com/wp-content/plugins/survey_creator.php</b> on line <b>374</b>

    There are three error code lines returning the same message: 362, 374 are showing up on the Survey Results download and and 420 is showing up when I download the comments.

    The code in question (starting from line 361 through line 432) is here:

    foreach($results as $result)
    {
    if($i!=0)
    {
    echo ",";
    }
    echo '"'.$questionarr[$result['questionid']].'"';
    $i++;
    }
    echo "nr";
    }
    $i = 0;
    foreach($results as $result)
    {
    if($i!=0)
    {
    echo ",";
    }
    echo '"'.$result['score'].'"';
    $i++;
    }
    echo "nr";
    //echo nl2br(print_r($questionarr,true))."";
    $num++;
    }
    exit();
    }
    if(($_GET['downloadcsvcomments'] == 'true') && is_numeric($_GET['id']))
    {
    $id = $_GET['id'];
    header('Content-Type: text/csv');
    header('Content-Disposition: inline; filename="survey_comments.csv"');
    $completesurveys = $wpdb->get_results("SELECT
    id FROM ".$table_prefix."survey-completed WHERE surveyid='”.$id.”‘”,ARRAY_A);
    $questions = $wpdb->get_results(“SELECT * FROM ".$table_prefix."survey-questions WHERE surveyid='”.$id.”‘”,ARRAY_A);
    foreach($questions as $question)
    {
    $questionarr[$question[‘id’]] = $question[‘name’];
    }
    $num = 0;
    foreach($completesurveys as $completed)
    {
    $results = $wpdb->get_results(“SELECT * FROM ".$table_prefix."survey-results WHERE completedid='”.$completed[‘id’].”‘”,ARRAY_A);
    if($num == 0)
    {
    $i = 0;
    foreach($results as $result)
    {
    if($i!=0)
    {
    echo “,”;
    }
    echo ‘”‘.$questionarr[$result[‘questionid’]].'”‘;
    $i++;
    }
    echo “\n\r”;
    }
    $i = 0;
    foreach($results as $result)
    {
    if($i!=0)
    {
    echo “,”;
    }
    echo ‘”‘.$result[‘comment’].'”‘;
    $i++;
    }
    echo “\n\r”;
    //echo nl2br(print_r($questionarr,true)).”
    “;
    $num++;
    }
    exit();

    I suck at PHP so I don’t understand what’s being presented here and what’s causing that conflict.

    Any help appreciated

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Survey Creator errors’ is closed to new replies.