$page_size = 10; // TODO: insert your here
if (empty($p)) $p = 1;
$limit = ($p-1) * $page_size;
$index = $limit + 1;
$sql = "select Id,Name,Pic1,Pic2,date_format(CDate, '%Y-%m-%d') as CDate "; // TODO: insert your here
$from = "download "; // TODO: insert your here
$today = date("Y-m-d");
if (empty($where)) $where = " ((StartD <= '$today') and (StopD > '$today')) "; // TODO: insert your here
if (empty($order)) $order = " sortid "; // TODO: insert your here
if (!empty($keyword))$where.= " and (name like '%$keyword%' or CDate like '%$keyword%')";
if (!empty($order_by)) { // manually ordered
$order = $order_by;
$order .= " " . $order_type;
$order_type = ($order_type == "asc" ? "desc" : "asc");
$curr_order = $order_by;
$order_by = "";
}
$limit = $limit . "," . $page_size;
$sql .= " from " . $from;
$sql_count = "select count(*) as total from " . $from;
$sql_count .= (empty($where) ? "" : " where " . stripslashes($where));
$sql .= (empty($where) ? "" : " where " . stripslashes($where));
$sql .= (empty($order) ? "" : " order by " . $order);
$query1=$sql;
$sql .= (empty($limit) ? "" : " limit " . $limit);
$rs = get_rs($conn, $sql_count);
$row = mysql_fetch_object($rs);
$total = $row->total;
mysql_free_result($rs);
$page_number = ceil($total/$page_size);
$rs = get_rs($conn, $sql);
$count = mysql_num_rows($rs);
$statusIndex=1;
?>
while($row=mysql_fetch_object($rs)) {?>
|
|
| | |