Well since I had to put a pause on my other scripts I've decided to work on a text based shoutbox. I figured if I did all the database stuff through .txt it would be nice and easy, but I am having one trouble with the fetch_shouts page:
What works:
1. Previous and Next page links.
2. Not showing previous pages posts
What doesn't work:
1. No matter what, my page always shows the next pages post.
Here is my code, the part I think is causing the problem is in bold.
<?php
$explodeMe = file_get_contents('shouts.txt');
$explosion = explode('||', $explodeMe);
$perPage = file_get_contents('settings.txt');
while ($explosion[$_GET['view']])
{
if ($_GET['view'] != 0)
{
echo '<div align="left">';
echo '<a href="fetch_shouts.php?view=';
echo $_GET['view']-$perPage;
echo '">Previous Page (';
echo $_GET['view']/$perPage;
echo ')</a></div>';
}
echo '<div align="center"><a href="http://www.purplenum.com/" target="_blank">Pobox©</a></div>';
if ($explosion[$_GET['view']+$perPage])
{
echo '<div align="right">';
echo '<a href="fetch_shouts.php?view=';
echo $_GET['view']+$perPage;
echo '">Next Page (';
if ($_GET['view'] == 0)
{
echo '2';
}
elseif ($_GET['view'] == 1)
{
echo $_GET['view']+$perPage;
}
else
{
echo $_GET['view']*$perPage;
}
echo ')</a></div>';
}
echo '<hr />';
$count = 1;
[b]while ($count !== $perPage)
{
$count++;
echo $explosion[$_GET['view']];
$_GET['view']++;
if ($explosion[$_GET['view']])
{
if ($count !== $perPage)
{
echo '<hr />';
}
}
}[/b]
}
?>
What that is meant to do is create a counter starting at 1, and echo each shout until the point where the counting variable is equal to the amount of shouts to show per page, at which point the script ends. But it seems to not do that, as seen in http://www.purplenum.com/php/shoutbox/fetch_shouts.php/.
Thanks for your time (Again!), I'm still very much a newb and I am trying to get as much php in tonight as I can before I have to go back to school, so I'm trying to do many different things in php.