CodeIgniter Forums
question to sessions - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: question to sessions (/showthread.php?tid=19070)



question to sessions - El Forum - 05-27-2009

[eluser]RcCluster[/eluser]
hi,

i do a query and try to store the result in a session-var

Code:
if ($Query->num_rows() > 0) {
  $rows = $Query->result_array();
  $this->session->set_userdata('ausgabeArray', $rows);

but i get no output then.

if i change the code to

Code:
if ($Query->num_rows() > 0) {
  $rows = $Query->result_array();
  echo "mist";
  $this->session->set_userdata('ausgabeArray', $rows);

then there is the right output except the errors at the top of the page (Message: Cannot modify header information ...)

is there someone out there knowing things like this?

thanks
RcCluster


question to sessions - El Forum - 05-27-2009

[eluser]sl3dg3hamm3r[/eluser]
What output do you expect from that snippet? You just set a session-var, but you don't echo anything. You might read your session-var like that:

Code:
echo $this->session->userdata('ausgabeArray');

P.s.: Please note that if you don't use any session-table on the database, the possible length of session-data is restricted.


question to sessions - El Forum - 05-27-2009

[eluser]RcCluster[/eluser]
[quote author="sl3dg3hamm3r" date="1243427845"]What output do you expect from that snippet? You just set a session-var, but you don't echo anything. You might read your session-var like that:

Code:
echo $this->session->userdata('ausgabeArray');

P.s.: Please note that if you don't use any session-table on the database, the possible length of session-data is restricted.[/quote]

i use this var to convert the ausgabeArray to excel via a php class. some queries need more than a few seconds thus i try it in this way.

i will change to session-table.

thanks
RcCluster


question to sessions - El Forum - 05-27-2009

[eluser]RcCluster[/eluser]
[quote author="sl3dg3hamm3r" date="1243427845"]P.s.: Please note that if you don't use any session-table on the database, the possible length of session-data is restricted.[/quote]

thanks thats it!