Ok, I'm trying to make a limit script for previous and next buttons, but for some reason the $start offset will not work properly, it seems to double what it should. I will miss out some things on purpose though...
if ($start = '') {
$start = 0;
}
$end = 5;
$query = "SELECT * FROM news_data LIMIT $start, $end";
$query2 = "SELECT COUNT(id) FROM news_data";
$result = mysql_query($query) or die("ERROR");
$result2 = mysql_query($query2) or die("ERROR");
$total_records = mysql_result($result2, 0);
$total_pages = ceil($total_records/$end);
// Now this is the problem part, I have 16 records in the db.
// $start should be equal to 5; but it goes to 11 and shows the
// last records, and misses the ones out in between.
$next_record = $start+$end;
if ($next_record >= $total_pages) {
$next_record = $total_records-$end;
}
Then after that there is the previous links, but that's constructed in more or less the same way, except opposite and it works. This might be something stupid, but I can't see it lol. HELP!!! 🙁