Gazelle/sections/questions/ajax_get_answers.php
2013-10-22 08:01:07 +00:00

36 lines
675 B
PHP

<?
$ID = (int)$_GET['id'];
if (empty($ID)) {
die();
}
$Text = new TEXT(true);
$UserID = (int)$_GET['userid'];
$UserIDSQL = "";
if (!empty($UserID)) {
$UserIDSQL = " AND UserID != '$UserID' ";
}
G::$DB->query("
SELECT UserID, Answer, Date
FROM staff_answers
WHERE QuestionID = '$ID'
$UserIDSQL
ORDER BY DATE DESC");
$Answers = G::$DB->to_array(false, MYSQLI_ASSOC);
foreach($Answers as $Answer) {
?>
<div class="box box2">
<div class="head">
<span>
Answer by <?=Users::format_username($Answer['UserID'])?> - <?=time_diff($Answer['Date'])?>
</span>
</div>
<div class="pad">
<?= $Text->full_format($Answer['Answer'])?>
</div>
</div>
<?
}
?>