fazzfarrell Posted June 1, 2007 Share Posted June 1, 2007 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 More sharing options...
chigley Posted June 1, 2007 Share Posted June 1, 2007 Put this in the code: echo "<pre>".print_r($row_rsUser,true)."</pre>"; And post the output here. I suspect your query is failing. Link to comment https://forums.phpfreaks.com/topic/53838-can-not-read-session/#findComment-266152 Share on other sites More sharing options...
fazzfarrell Posted June 1, 2007 Author Share Posted June 1, 2007 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 More sharing options...
fazzfarrell Posted June 4, 2007 Author Share Posted June 4, 2007 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 More sharing options...
per1os Posted June 4, 2007 Share Posted June 4, 2007 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 More sharing options...
fazzfarrell Posted June 4, 2007 Author Share Posted June 4, 2007 ermm? the $row_rsUser['Percent'] is coming from a database with values such as 17.5, 25 and 35. I can put this colum as it is on the page and it displays the value. It is defined when the user has logged in? Link to comment https://forums.phpfreaks.com/topic/53838-can-not-read-session/#findComment-267550 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.