如何让PDO从多个表中进行选择

时间:2013-08-24 19:58:15

标签: mysql pdo

这是我的代码:

$sql= ("SELECT R.cr_id,R.time,R.reply,U.user_id,U.user_name FROM tb_user U, conversation_reply R WHERE R.user_id_fk=U.user_id and R.c_id_fk='$c_id' ORDER BY R.cr_id ASC LIMIT 20");
$stmt = $conn->prepare($sql);
$stmt->execute();
$row=$stmt->fetchAll();


foreach ($row as $laww) {

echo $laww['$user_name'].":". $laww['reply']. "<br>";
}

}////END 

我只得到$ laww ['reply']的结果,但不是$ laww ['$ user_name'] 谁能帮助我?

0 个答案:

没有答案