通过从具有公用列的两个表中选择数据来获得未定义的索引

时间:2018-07-18 22:21:25

标签: php mysql

我有两个表-homepostshome.artid等于posts.id

要从id, artid, inde中选择home,再从title中选择posts
home.posslider的地方:

$items = "";
$st = $db->query("select home.id, home.artid, home.inde 
                    from home 
                        join posts on home.artid = posts.id 
                    where home.pos = 'slider' 
                    order by home.inde asc");
while ($row = $st->fetch()){
    $items .= "<div class='slidertitle'>" . $row['posts.title'] . "</div>\n";
}
echo $items;

错误:
未定义索引posts.title...

有帮助吗?

1 个答案:

答案 0 :(得分:1)

如果您想选择xcode-select --install,请选择它

posts.title