|
|
|
| Здарова народ
Зделал так:
<?php
// Агар дар ин сахифа коммент бошад онхоро мебарорем
$tbl_comment = "system_lesson_comment";
$query_comment = "SELECT id, comment, author, date
FROM ".$tbl_comment."
WHERE id_lesson = ".$_GET["id_les"]."
ORDER BY id
DESC";
$res_comment = mysql_query($query_comment) or die(mysql_error() . "<br><strong>Итнихоб аз чадвал нагузашт</strong>");
if(mysql_num_rows($res_comment) > 0)
while($row_comment = mysql_fetch_array($res_comment))
{
echo "<div class='box'>
<p class='comment'>$row_comment[comment]</p>
<table>
<tr class='notice'><td>Муфллиф: </td><td class='author'>$row_comment[author]</td></tr>
<tr class='notice'><td>Таърих: </td><td>$row_comment[date]</td></tr>
</table>
</div><div class='mb'></div>";
}
// Агар дар коммент чавоб бошад онхоро хам мебарорем
$tbl_comment_answer = "system_lesson_comment_answer";
$query_comment_answer = "SELECT answer, author, date
FROM ".$tbl_comment_answer."
WHERE id_comment = ".$row_comment["id"]."
ORDER BY id
DESC";
$res_comment_answer = mysql_query($query_comment_answer) or die(mysql_error() . "<br><strong>Итнихоб аз чадвал нагузашт</strong>");
if(mysql_num_rows($res_comment_answer) > 0)
while($row_comment_answer = mysql_fetch_array($res_comment_answer))
{
echo "<div class='box'>
<p class='comment'>$row_comment_answer[answer]</p>
<table>
<tr class='notice'><td>Муфллиф: </td><td class='author'>$row_comment_answer[author]</td></tr>
<tr class='notice'><td>Таърих: </td><td>$row_comment_answer[date]</td></tr>
</table>
</div><div class='mb'></div>";
}
?>
|
Ошибка:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ORDER BY id DESC' at line 4
Итнихоб аз чадвал нагузашт
А как вы зделаете?
Спасибо | |
|
|