Vincent
Vincent

Reputation: 1730

Session value can't be updated, why?

I am using the following code on the server of a client:

<?php
session_start();
$_SESSION['count']++;
print_r($_SESSION);
?>

Here is the thing: when I refresh the page, it keeps displaying 1 as a value for $_SESSION['count']

What parameter should I look into in the phpinfo() to see where the problems come from?

I am kind of stuck here, any idea of what could be wrong? Thanks.

UPDATE: problem solved, the session.save_path parameter wasn't set correctly on the server.

Upvotes: 0

Views: 76

Answers (1)

Madbreaks
Madbreaks

Reputation: 19539

Are you initializing it anywhere?

$_SESSION['count'] = isset($_SESSION['count']) ? $_SESSION['count'] + 1 : 1;

Upvotes: 2

Related Questions