Justtechjobs.com Find a programming school near you






Online Campus Both


php-db | 2000121

Re: [PHP-DB] PHP module v. PHP CGI with MySQL From: Doug Semig (dougslist <email protected>)
Date: 12/05/00

Perhaps it is not automatically retrieving the GET variable "page" for some
reason?

You might try something like this (if track_vars is set on in your .ini):

if (!$page) {
  if ($HTTP_GET_VARS["page"]) $page = $HTTP_GET_VARS["page"];
  else {
    echo "<HTML><HEAD><TITLE>Error</TITLE></HEAD><BODY>I cannot ";
    echo "find the page variable anywhere!</BODY></HTML>";
    exit;
  }
}

Just a guess at best...

Doug

At 11:23 AM 12/5/00 -0500, Sean Brown wrote:
>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

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-db-unsubscribe <email protected>
For additional commands, e-mail: php-db-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>