Paul-D Posted July 6, 2019 Share Posted July 6, 2019 Hi I call a function with values of 51 and 100 but the function receives values 1 and 50 <?php // EmilyMoor Version 1.0.0 05-07-2019 Desmond O'Toole. ini_set('display_errors', 1); error_reporting(E_ALL); require("../secure/SecureFunctions.php"); require("secure/SecureFunctionsEmilyMoor.php"); $page = "Emily Moor"; session_start(); $Browser = $_SERVER['HTTP_USER_AGENT']; if (!isset($_SESSION["PageValue"])) $_SESSION["PageValue"] = '1'; $_SESSION["PageValue"] = 2; // Keeps going back to 1 if($_SESSION["PageValue"] == 1) { $_SESSION["StartValue"] = 1; $_SESSION["EndValue"] = 50; } if($_SESSION["PageValue"] == 2) { $_SESSION["StartValue"] = 51; $_SESSION["EndValue"] = 100; } if($_SESSION["PageValue"] == 3) { $_SESSION["StartValue"] = 101; $_SESSION["EndValue"] = 150; } if($_SESSION["PageValue"] == 4) { $_SESSION["StartValue"] = 151; $_SESSION["EndValue"] = 200; } if($_SESSION["PageValue"] == 5) { $_SESSION["StartValue"] = 201; $_SESSION["EndValue"] = 250; } if($_SESSION["PageValue"] == 6) { $_SESSION["StartValue"] = 251; $_SESSION["EndValue"] = 300; } echo $_SESSION["PageValue"] . " - " . $_SESSION["StartValue"] . " - " . $_SESSION["EndValue"] . "<br>"; $qStationDetails = GetChanelInfo($_SESSION["StartValue"],$_SESSION["EndValue"]); $rs = mysql_fetch_array($qStationDetails) or die ("E3001-101A"); $Name = $rs['Description']; ?> function GetChanelInfo($StartCH, $EndCH) // E2004 { echo "Channels = " . $StartCH . " " . $EndCH . "<br>"; // values are 1 and 50 $sqlChanelInfo = "SELECT * FROM TV_EmilyMoor WHERE ID >= $StartCH and ID <= $EndCH"; echo $sqlChanelInfo . "<br />"; $qChanelInfo = mysql_query($sqlChanelInfo) or die ("E3004-01A"); return $qChanelInfo; } Quote Link to comment Share on other sites More sharing options...
Paul-D Posted July 6, 2019 Author Share Posted July 6, 2019 Problem solved please ignore Quote Link to comment Share on other sites More sharing options...
Barand Posted July 6, 2019 Share Posted July 6, 2019 (edited) Why all those if() statements? startValue = (pageValue - 1) * 50 + 1 endValue = startValue + 49 (or pageValue * 50) Edited July 6, 2019 by Barand Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.