CodeIgniter Forums
Guidance Needed - 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: Guidance Needed (/showthread.php?tid=57838)



Guidance Needed - El Forum - 04-15-2013

[eluser]Uresh Patel[/eluser]

I have one requirement like i need to display 5 fields of a login user on every page of website.
(Name,DOB,Age,Nationality,Height)
I am not sure to which way i need to choose from.I think of 2 ways here.

1. I store 5 fields in session at time of login

2. I create a model method that gives all this data and call that from all controller.method through of the site.



Guidance Needed - El Forum - 04-15-2013

[eluser]jairoh_[/eluser]
why on every page? well if that is ur case u can use javascript or jquery. u write it only once ( could be on the footer, just hide it.) i
would that if i were u.


Guidance Needed - El Forum - 04-16-2013

[eluser]Uresh Patel[/eluser]
[quote author="jairoh_" date="1366095222"]why on every page? well if that is ur case u can use javascript or jquery. u write it only once ( could be on the footer, just hide it.) i
would that if i were u.[/quote]


Guidance Needed - El Forum - 04-16-2013

[eluser]TheFuzzy0ne[/eluser]
I think I'd store it in the session.

It's only a relatively tiny amount of data (around 100 bytes?), so it should be fine in a cookie. If you have database sessions enabled, that's even better yet.


Guidance Needed - El Forum - 04-17-2013

[eluser]Uresh Patel[/eluser]
Hi,
Thank you for reply.
I have stored that data in session.Looks good.But then i found another issue like when user will update records of profile that will not show updated data on left bar.Coz it already stored login time session data.
Or i need to update session data at time of update profile...

[quote author="TheFuzzy0ne" date="1366129431"]I think I'd store it in the session.

It's only a relatively tiny amount of data (around 100 bytes?), so it should be fine in a cookie. If you have database sessions enabled, that's even better yet.[/quote]




Guidance Needed - El Forum - 04-19-2013

[eluser]jairoh_[/eluser]
[quote author="Uresh Patel" date="1366183970"]Hi,
Thank you for reply.
I have stored that data in session.Looks good.But then i found another issue like when user will update records of profile that will not show updated data on left bar.Coz it already stored login time session data.
Or i need to update session data at time of update profile...

[quote author="TheFuzzy0ne" date="1366129431"]I think I'd store it in the session.

It's only a relatively tiny amount of data (around 100 bytes?), so it should be fine in a cookie. If you have database sessions enabled, that's even better yet.[/quote]

[/quote]
then update the session when the user updates the record Big Grin