p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   PHP How-To (http://p2p.wrox.com/forumdisplay.php?f=98)
-   -   php take get variable and dynamically set values (http://p2p.wrox.com/showthread.php?t=63076)

crmpicco October 21st, 2007 08:35 AM

php take get variable and dynamically set values
 
Code:

if ($page == 2) {
  $minimum = 10;
  $maximum = 20;
} else {
  $minimum = 0;
  $maximum = 10;
}

I have a variable "$page" in my script, if I $page is 3 then the minimum and maximum values would need to be 20 and 30 respectively. Is there a way I can amend the code above to make it more dynamic that just purely having if statements catching the $page value and setting the values as I am just now?

Any help is very much appreciated,
Picco
[:I]

www.crmpicco.co.uk
www.ie7.com

sdi126 October 22nd, 2007 07:19 PM

$page = (isset($page)) ? $page : 1;

$minimum = ($page - 1) * 10;
$maximum = (($page - 1) * 10) + 10;

http://mynameissteve.com


All times are GMT -4. The time now is 06:23 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.