Beispiel #1
0
function UpdateQuestion()
{
    $select = SelectQuestion();
    $new_array = [];
    $count = 0;
    while ($row = $select->fetch()) {
        $new_array[$count]['id'] = $row['id'];
        $new_array[$count]['question'] = $row['question'];
        $new_array[$count]['answers'] = [0 => $row['answer_0'], 1 => $row['answer_1'], 2 => $row['answer_2'], 3 => $row['answer_3']];
        $count++;
    }
    return $new_array;
}
Beispiel #2
0
         while ($row = $result->fetch_assoc()) {
             $name = $row["name"];
             $email = $row["email"];
             $topic = $row["topic"];
             $content = $row["content"];
             $vote = $row["vote"];
         }
     } else {
         echo "0 results";
     }
     $datetime = GetDateTime($conn, $id);
 } else {
     if (isset($_GET['id'])) {
         // if the previous page was the homepage
         $id = (int) $_GET['id'];
         $result = SelectQuestion($conn, $id);
         if ($result->num_rows > 0) {
             // output data of each row
             while ($row = $result->fetch_assoc()) {
                 $name = $row["name"];
                 $email = $row["email"];
                 $topic = $row["topic"];
                 $content = $row["content"];
                 $vote = $row["vote"];
             }
         } else {
             echo "0 results";
         }
         $datetime = GetDateTime($conn, $id);
     }
 }