开发者

PHP/Session/IE: Constant are saved, variable not

I have a very strange problem.

Situation: Session handling over MySQL, PHP 5.2.4, wildcard cookies, FF/Opera/Safari/Chrome works, IE7/8 not.

When I save a variable into the session, the value is lost. The DB shows after the write action only "N" instead of "123456".

Example:

$bar = 123456;
$_SESSION['foo'] = $bar;

But when I save a constant in the session, it works.

$_SESSION['foo'] = 123456;

This is not really a client problem, but only in IE it doesn't work.

Any ideas?

Edit:

This is the session write function:

function _write($id, $data) {

    $write = "UPDATE session SET time='".time()."', data='".mysql_real_escape_string($开发者_StackOverflow中文版data)."' WHERE id='".mysql_real_escape_string($id)."'";
    $result = @mysql_query($write);
    if(mysql_affected_rows()) return $result;
    else {
        $write = "INSERT INTO session (id, time, data) VALUES ('".mysql_real_escape_string($id)."', '".time()."', '".mysql_real_escape_string($data)."')";
        return @mysql_query($write);
    }
}

When I print the update query ($write) everything looks fine. I can execute the SQL manually and it works, also with variables.


Maybe sessionId in cookie every time is refreshing in IE?
SO every time - new session

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜