function get_paging_comments($action_id, $start = 0, $limit = 0) { $query = he_database::placeholder("SELECT `c`.*, `u`.`user_username`, `u`.`user_fname`, `u`.`user_lname`, `u`.`user_photo`\r\n FROM `se_he_wall_comment` AS `c` \r\n INNER JOIN `se_users` AS `u` ON (`c`.`author_id`=`u`.`user_id`)\r\n WHERE `c`.`action_id`=?\r\n ORDER BY `c`.`id`", $action_id); if ($start < 0) { $start = 0; } if ($start != 0 && $limit != 0) { $query .= " LIMIT {$start}, {$limit}"; } elseif ($start == 0 && $limit != 0) { $query .= " LIMIT {$limit}"; } $count = he_database::num_rows(he_database::query($query)); $temp = he_database::fetch_array($query); foreach ($temp as $key => $t) { $temp[$key]['author'] = new se_user(array($t['author_id'])); } $action_comments[$action_id] = $temp; return array('count' => $count, 'action_comments' => $action_comments, 'sql' => $query); }