Jump to content

can not read session


fazzfarrell

Recommended Posts

I have a session

<?php
session_start();
$DisTotal = $row_rsUser['Percent'];
$_SESSION["DisTotal"] = $DisTotal; 
?>

 

this does not work

 

if I do this:

<?php
session_start();
$DisTotal = 117.5;
$_SESSION["DisTotal"] = $DisTotal; 
?>

 

but this does? Can any one see what I have done wrong?

 

 

Link to comment
https://forums.phpfreaks.com/topic/53838-can-not-read-session/
Share on other sites

I get this

 

Array

(

    [Name] => Rob Farrell

    [HouseNo] => 00

    [street] => Nowhere rd

    [Town] => China

    [County] => Staffordshire

    [PostCode] => SB2 3YY

    [Tel] => 01453000000

    [Mobile] => 0772000000

    [Pref] => Yes

    [DisCode] => RF

    => [email protected]

    [Password] => *****

    [Percent] => 117.5

)

Link to comment
https://forums.phpfreaks.com/topic/53838-can-not-read-session/#findComment-266155
Share on other sites

Still cant work this one out can any one see what I am doing wrong?

 

<?php
session_start();
$DisTotal = $row_rsUser['Percent'];
$_SESSION["DisTotal"] = $DisTotal;
?>

 

It is not picking up the percentage? I can trow the data on the page and it diaplays as 17.5 but when I try and use the above session it does not?

Link to comment
https://forums.phpfreaks.com/topic/53838-can-not-read-session/#findComment-267537
Share on other sites

Unless you defined the $row_rsUser in that test page it will not work.

 

<?php
$row_rsUser['Percent'] = 117.5
session_start();
$DisTotal = $row_rsUser['Percent'];
$_SESSION["DisTotal"] = $DisTotal;
?>

 

Even with test pages you need to have test data, as I bet if you did this:

 

<?php
//$row_rsUser['percent'] = 117.5
//session_start();
//$DisTotal = $row_rsUser['Percent'];
//$_SESSION["DisTotal"] = $DisTotal;
echo '<pre>',print_r($row_rsUser),'</pre>';
?>

 

You would not have any data printed to the screen as $row_rsUser has not been defined yet.

 

If it is being defined, post more relevant code.

Link to comment
https://forums.phpfreaks.com/topic/53838-can-not-read-session/#findComment-267549
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.