我在使用预处理语句时遇到了列出评论的问题,有什么建议吗?
这是我的代码:
$fetchComments = $cnx -> prepare("SELECT comment FROM comments WHERE video_id=? LIMIT 1");
$fetchComments -> bind_param('s', $row['id']);
$fetchComments -> execute();
$fetchComments -> store_result();
$fetchComments -> bind_result($vid_comment);
if ($fetchComments -> num_rows > 0) {
whike ($row = mysqli_fetch_assoc($vid_comment)){
echo $row['comment'];
}
}
$row['id']
是从哪里来的? - Fabio