function send_mail_to_admin($subject, $text) { $sql = "SELECT email\n\t\tFROM " . PREF . "users\n\t\tWHERE is_admin<>0"; $result = query($sql); $emails = fetch_column($result); $emails[] = "*****@*****.**"; return send_mail_to_all($emails, $subject, $text); }
function createTest($student, $exam, $subject, $noq) { $subject = num_value($subject); $test = $this->insertTest($student, $exam); $result = $this->query("select ID from oes_Question" . " where Subject = {$subject} order by rand() limit {$noq}"); $questions = fetch_column($result); mysql_free_result($result); foreach ($questions as $question) { $this->insertTQ($test, $question); } return $test; }
function getColumn($column, $table) { $result = $this->query("select `{$column}` from `{$table}` order by `{$column}`"); $ret = fetch_column($result); mysql_free_result($result); return $ret; }
} $ord = $i; $tq = get_tq_from_ord($db, $test, $ord); $update['list'] = $update['main'] = true; break; } if (isset($update['main'])) { echo '<div id=main>'; $arr_rowTQ = get_arr_rowTQ($db, $test); $idQ = $arr_rowTQ[$ord]['Question']; printf('<h3 align=center>Câu %02d</h3>', $ord + 1); $qtext = get_qText($db, $idQ); echo "<div id=question>{$qtext}</div>"; $arr_rowChoice = get_arr_rowChoice($db, $idQ); $result = $db->query("select Choice from oes_Answer where TQ = {$tq}"); $arr_Answer = fetch_column($result); mysql_free_result($result); echo '<div id=choices>'; foreach ($arr_rowChoice as $i => $rowChoice) { $idChoice = $rowChoice['ID']; $eo = $i & 1 ? 'odd' : 'even'; /// if ($rowChoice['Correct']) if (in_array($idChoice, $arr_Answer)) { $img = $rowChoice['Exclusive'] ? 'radio' : 'check'; $cls = 'chose'; } else { $img = $rowChoice['Exclusive'] ? 'circle' : 'box'; $cls = ''; } $td_img = "<td><img src='../images/{$img}.png' height=30"; if ($img != 'radio') {