I am trying to write a simple (at least it should be) loop to number a list. Here is my code:
if ($post_row = mysql_fetch_array($result)) {
do {
echo "<b><a href='weblog.php?id=$p#$post_row[title]'>$post_row[date]</b> - <em>$post_row[title]</em></a><br>\n";
$p++;
} while ($post_row = mysql_fetch_array($result));
I want the first 7 items in the list to have a link to page 1, the second 7 items to page 2, etc.
I know I've got to have an if statement in there before my echo statement that checks whether or not $p is equal to something. I've tried throwing in a $max_posts variable and setting it equal to 7 and then doing:
if (fmod($p, $max_posts) == "0") {
$p++;
}
thinking that only 7, 14, 21, etc would give me an answer of exactly 0, but that doesnt quite work 100% correctly.
Call me a loser 😉 but I cannot figure this thing out. 😕