这就是我到目前为止所拥有的。它调用数据库并接收一条评论和所有与之相关的值,但我想获得具有相同 id 的多条评论。如何设置数组以获取多个评论?
function get_comment_by_id($lake_id) {
global $connection;
$query = "SELECT * ";
$query .= "FROM comments ";
$query .= "WHERE lakeId=" . $lake_id ." ";
//$query .= "LIMIT 1";
$result_set = mysql_query($query, $connection);
confirm_query($result_set);
// REMEMBER:
// if no rows are returned, fetch_array will return false
if ($comment = mysql_fetch_array($result_set)) {
return $comment;
} else {
return NULL;
}
}