Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/242.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在PHP中通过变量传递数据_Php_Variables - Fatal编程技术网

在PHP中通过变量传递数据

在PHP中通过变量传递数据,php,variables,Php,Variables,我正在进行的一个基本程序存在一些问题:我的目标是从表indexLearningStyle中获取4个学习维度,例如(轻度活跃、中度活跃等),然后我的目标是根据前面的维度打印ILS反馈表中的反馈。然而,无论优先值是Mildy还是Strongly,我都希望打印一般反馈。如果您有任何关于目前无法使用的建议,我们将不胜感激 <?php $mildlyActive = "active"; $moderatelyActive = "active"; $stronglyActiv

我正在进行的一个基本程序存在一些问题:我的目标是从表indexLearningStyle中获取4个学习维度,例如(轻度活跃、中度活跃等),然后我的目标是根据前面的维度打印ILS反馈表中的反馈。然而,无论优先值是Mildy还是Strongly,我都希望打印一般反馈。如果您有任何关于目前无法使用的建议,我们将不胜感激

<?php

    $mildlyActive = "active";
    $moderatelyActive = "active";
    $stronglyActive = "active";

    $mildlyReflective = "reflective";
    $moderatelyReflective = "reflective";
    $stronglyReflective = "reflective";

    $mildlySensing = "sensing";
    $moderatelySensing = "sensing";
    $stronglySensing = "sensing";

    $mildlyIntuitive = "intuitive";
    $moderatelyIntuitive = "intuitive";
    $stronglyIntuitive = "intuitive";

    $mildlyVisual = "visual";
    $moderatelyVisual = "visual";
    $stronglyVisual = "visual";

    $mildlyVerbal = "verbal";
    $moderatelyVerbal = "verbal";
    $stronglyVerbal = "verbal";

    $mildlySequential = "sequential";
    $moderatelySequential = "sequential";
    $stronglySequential = "sequential";

    $mildlyGlobal = "global";
    $moderatelyGlobal = "global";
    $stronglyGlobal = "global";

    $dbQuery = $db->prepare("select dimension1, dimension2, dimension3, dimension4 FROM indexLearningStyle WHERE studentNumber = '".$currentUser."'");
    $dbQuery-> execute();

    while ($dbRow = $dbQuery->fetch (PDO::FETCH_ASSOC)) {
    $dimension1 = $dbRow["dimension1"];
    $dimension2 = $dbRow["dimension2"];
    $dimension3 = $dbRow["dimension3"];
    $dimension4 = $dbRow["dimension4"]; 

    }

    $dbQuery = $db->prepare("select answerType, studentDefinition FROM ilsFeedback");
    $dbQuery-> execute();

    while ($dbRow = $dbQuery->fetch (PDO::FETCH_ASSOC)) {
    $answerType = $dbRow["answerType"];
    $studentDefinition = $dbRow["studentDefinition"];

    } 
    if ($dimension1 = "Mildly Active" || $dimension1 = "Moderately Active" || $dimension1 = "Strongly Active"){
    $dbQuery = $db->prepare("select answerType, studentDefinition FROM ilsFeedback WHERE answerType = 'active'");
    $dbQuery-> execute();
    $studentDefinition = $dbRow["studentDefinition"];
    echo $studentDefinition;
    }
else {
    if ($dimension1 == $mildlyReflective || $dimension1 == $moderatelyReflective || $dimension1 == $stronglyReflective){
    $dbQuery = $db->prepare("select answerType, studentDefinition FROM ilsFeedback WHERE answerType = 'reflective'");
    $dbQuery-> execute();

    $studentDefinition = "studentDefinition";
    echo $studentDefinition;
    }
}

?>  

您是否仅用每个结果集中的最后一个结果覆盖变量?请注意:
如果($dimension1=“轻度活动”…
-这不是一个比较,而是一个赋值。这可能会引起您的问题,但我不确定,因为我现在无法完全理解您的问题。