PHP module v. PHP CGI with MySQL
| From: | Sean Brown | Date: | Tue, 05 Dec 2000 16:23:29 +0000 |
| Subject: | PHP module v. PHP CGI with MySQL | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-5020@lists.php.net to get a copy of this message | ||
List,
I've got an interesting dillema. I've got a PHP site that connects to a
MySQL database to serve dynamic content. Here's a quick example. News is
stored in a table called "news" and is displayed in chunks of 5 news items
at a time. It works like so:
// which "page" are we on? Set default to 0 if none set.
if (!$page) {
$page = 0;
}
$pagesize = 5;
$next = $page + $pagesize;
$prev = $page - $pagesize;
$querystring = "SELECT * FROM news ORDER BY date_entered DESC LIMIT
$page,$pagesize";
// now it iterates through the recordset and prints out the
// most recent 5 news items, then displays a link to allow
// the user to see older news items, like so:
echo "<a href=news.phtml?page=$next&mode=news>Older news</a>";
If the user clicks on the link, they get to see the next 5 older news items.
This all has worked perfectly fine for the past couple of years as the site
has been served using PHP as a module for Apache (on Linux). No problems
whatsoever.
Recently, I have been trying out Orion (a java appserver). In order to use
PHP with it, I have installed PHP as a CGI. All PHP functyions have worked
just fine. The code above works....
Except, the link to look at older news items does not work. It just
redisplays the same news items (database records). No errors, no issues.
It just continually shows the 5 most recent news items. Even if I manually
change the "page" in the URL on my browser...
http://www.mysite.com/news.phtml?page=15
it still displays the first five.
Is there anything about using PHP as a CGI that would disallow the above to
work?
Thanks,
Sean