Exemple #1
0
                    return;
                }
            }
        }
    }
    return json_encode($arry, JSON_UNESCAPED_UNICODE);
}
?>

<?php 
session_start();
$id = $_SESSION["ID"];
$firstCommentID = $_SESSION["firstCommentID"];
$sql = 'SELECT jobs_activity_comment.comment_cont,
				jobs_activity_comment.create_time,
				jobs_userinfo.head_pic,
				jobs_userinfo.nickname,
				jobs_activity_comment.user_id,
				jobs_activity_comment.user_type,
				jobs_activity_comment.activity_id,
				jobs_activity_comment.comment_id
				FROM jobs_activity_comment
				INNER JOIN  jobs_userinfo 
				ON jobs_activity_comment.user_id = jobs_userinfo.user_id
				AND jobs_activity_comment.user_type = jobs_userinfo.type
				WHERE jobs_activity_comment.activity_id = ' . $id . ' ORDER BY jobs_activity_comment.comment_id DESC;';
$result = $conn->query($sql);
echo loadMore($_GET["currentPage"], $result, $firstCommentID);
?>

Exemple #2
0
define("DEFAULT_SHOW", 10);
function loadMore($page, mysqli_result $result)
{
    $pos = 0;
    $cnt = 0;
    $arry = array();
    while ($row = $result->fetch_assoc()) {
        if ($pos != $page * DEFAULT_SHOW) {
            $pos++;
            continue;
        } else {
            if ($cnt < DEFAULT_SHOW) {
                array_push($arry, $row);
                $cnt++;
            } else {
                break;
                return;
            }
        }
    }
    return json_encode($arry, JSON_UNESCAPED_UNICODE);
}
?>

<?php 
$sql = "SELECT info_id,\n\t\t\t\t\tcaption,\n\t\t\t\t\torigin,\n\t\t\t\t\tpublish_date,\n\t\t\t\t\tfav,\n\t\t\t\t\tpic_link,\n\t\t\t\t\torigin_link,\n\t\t\t\t\tsubhead\n            FROM jobs_infomation \n            where subtype = '1'\n            AND flag='0'\n            ORDER BY publish_date DESC,info_id desc;";
$result = $conn->query($sql);
echo loadMore($_GET["currentPage"], $result);
?>