0

大家好,我是 PHP 和 MySQL 的新手,但我需要一个简单的(可能)sql 查询,它将从一个类别中选择所有已发布的链接(例如 ID 号为 6 的运动)

现在我有一个查询,可以从所有类别中选择所有已发布的新闻

<ul>
    {php}
$result = mysql_query('SELECT * from ' . table_links . ' WHERE link_status = "published" ORDER BY link_published_date DESC LIMIT 5');
    while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
        printf("<li>%s voturi | <a href='".$this->_vars['my_pligg_base']."/story.php?id=%s'><span style='font-weight:bold'>%s</span></a></li>", $row["link_votes"], $row["link_id"], $row["link_title"]);
    }
    {/php}
</ul>

先感谢您!

4

1 回答 1

0

找到正确的查询,谢谢!

<ul>
    {php}
$result = mysql_query('SELECT * from ' . table_links . ' WHERE link_status = "published"  and link_category = 1 ORDER BY link_published_date DESC LIMIT 5');
    while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
        printf("<li>%s voturi | <a href='".$this->_vars['my_pligg_base']."/story.php?id=%s'><span style='font-weight:bold'>%s</span></a></li>", $row["link_votes"], $row["link_id"], $row["link_title"]);
    }
    {/php}
</ul>
于 2013-05-28T12:55:05.200 回答