- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
$offset = intval($_POST['offset']);
$sql = mysql_query("SELECT * FROM `test` ORDER BY id DESC LIMIT $offset, 5");
if(mysql_num_rows($sql)>0) {
while($post = mysql_fetch_assoc($sql)){
foreach($post AS $n=>$m){
$post[$n] = utf8_encode($m);
}
$json['more'][] = $post; # чтобы было легче до
}
if(count($json['more'])) {
$json['ok'] = '1';
} else {
$json['ok'] = '0';
}
} else {
$json['ok']='3';
}
mysql_close($db);
echo json_encode($json);