FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Re: Counter reset or not?
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Counter reset or not? [message #182524 is a reply to message #182490] Sat, 10 August 2013 12:49 Go to previous messageGo to previous message
Richard Yates is currently offline  Richard Yates
Messages: 86
Registered: September 2013
Karma:
Member
On Thu, 08 Aug 2013 12:15:30 -0400, Twayne <nobody(at)spamcop(dot)net> wrote:

>>> <code>
>>> if($_SESSION["cntr"] > "0") {
>>> echo "Count is now : " . $_SESSION["cntr"]." ";
>>> }
>>> ELSE {
>>> $_SESSION['cntr']="0";
>>> $cntr=$_SESSION['cntr'];
>>> echo "Counter : " . $cntr."<br />";
>>> }
>>> </code>

> Specifically what do you mean by 'set" it above the if?

It's part of a basic debugging strategy. If a script is not working,
start breaking it into smaller pieces to see how variables change as
it flows. You are using two pages and session variables. You don't
know if the session variable is being set wrong, or is not accessible
to page 2, or page 2 is faulty. So...

on page 2 insert the line:

$_SESSION['cntr']=1;

before:

if($_SESSION["cntr"] > "0") {

If the results are still screwy then the problem is on page 2. If they
are correct, then the problem is page 1 or in accessing the session
variable on page 2.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: fetching value from related multiple rows & columns in PHP SQL
Next Topic: Please evaluate my cache-control & pragma etc. code
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Fri Nov 22 16:56:30 GMT 2024

Total time taken to generate the page: 0.04026 seconds