$answered[1] = "Yes";
$cnt = 0;
while ($row = mysqli_fetch_assoc($questions_list)) {
    $cnt++;
    ?>

                  <tr>
                    <td><?php 
    echo $row['eq_id'];
    ?>
</td>
                    <td><a style ="cursor:pointer;" onclick="$('#ans_<?php 
    echo $row['eq_id'];
    ?>
').toggle();"><?php 
    echo checkAnsFormat($row['question_text']);
    ?>
</a></td>
                    <td><?php 
    echo $cat[$row['category']];
    ?>
</td>
                    <td><?php 
    echo $answered[$row['is_answered']];
    ?>
</td>
                    <?php 
    if (checkUserType() == 'admin') {
        ?>
                    <td>
                        <a href="edit-essay-question.php?eq_id=<?php 
Пример #2
0
function get_question_answers_html($question_id)
{
    global $db;
    // Sanitize input parameter prior to making query
    $safe_question_id = mysqli_real_escape_string($db, $question_id);
    $query = "SELECT * ";
    $query .= "FROM answer ";
    $query .= "WHERE question_id = {$safe_question_id}";
    $result = mysqli_query($db, $query);
    confirm_query($result);
    $answer_set = array();
    $id = 0;
    $ansHtml = '<div style="padding-left:50px;">';
    while ($row = mysqli_fetch_assoc($result)) {
        $answer_set[$id++] = $row;
        $fontClass = $row['is_correct'] == 1 ? "correct" : "";
        //if($question_id != 573 )
        //$ansHtml .= $id.'. <span class="'.$fontClass.'">'.html_entity_decode($row['answer_text']).'</span><br>';
        //else
        $ansHtml .= $id . '. <span class="' . $fontClass . '">' . checkAnsFormat($row['answer_text']) . '</span><br>';
    }
    $ansHtml .= '</div>';
    return $ansHtml;
}