now the fix for the chat is commited -.-

main
hecht 10 years ago
parent b5f783823b
commit e4748af6a0

@ -70,12 +70,22 @@ function getChatMessages($userid, $messageid = 0, $asc = true, $limit = 25){
if(!is_numeric($messageid)){
$messageid = 0;
}
$row = mysql_fetch_row(db_query('Select max(id) from ag_chat'));
$row = mysql_fetch_row(db_query('Select max(id), count(id) from ag_chat'));
$maxid = $row[0];
$minid = $maxid - $limit;
$count = $row[1];
if($maxid === null) {
$maxid = 0;
}
if($count > $limit) {
$minid = $maxid - $limit;
} else {
$minid = $maxid - $count;
}
if($messageid > $minid){
$minid = $messageid;
}
$result = db_query('SELECT *, Minute(zeit) as m, Hour(zeit) as h FROM ag_chat WHERE id > '.$minid.' ORDER BY ID ASC LIMIT '.$limit);
while ($row = mysql_fetch_assoc($result)) {

Loading…
Cancel
Save