[FX.php List] Trying to read back an array

Bob Patin bob at patin.com
Fri Sep 17 07:57:49 MDT 2010


Very good point, not sure why I didn't think of that way; have one array rather than 5.

So when I read back from teh array, should I use this that you sent me?

if( (isset($_SESSION['recid'] && is_array($_SESSION['recid'])) {

OR can I get away with this:

foreach($_SESSION['recid'] as $recid) {

Thanks,

Bob


On Sep 17, 2010, at 8:53 AM, Leo R. Lundgren wrote:

> You're always welcome!
> 
> I second what Dale said. It seems you want to store stuff in the session per recordId. This would be a nice structure for that:
> 
> 	$_SESSION[$recid]['type']
> 	$_SESSION[$recid]['description']
> 	...
> 
> 
> 17 sep 2010 kl. 15.49 skrev Bob Patin:
> 
>> OH! I see now... I didn't notice I'd done that.
>> 
>> I understand now... oops... duh... started way too early this morning.
>> 
>> Thanks as always... :)
>> 
>> Best,
>> 
>> Bob
>> 
>> 
>> 
>> On Sep 17, 2010, at 8:47 AM, Leo R. Lundgren wrote:
>> 
>>> You store using this key in the array:
>>> 
>>> 	$_SESSION['description['.$recid.']']
>>> 
>>> The key in the array will be "description[123]" for a recid of 123.
>>> 
>>> You then try to fetch it using this:
>>> 
>>> 	$_SESSION['description'.$recid]
>>> 
>>> Which is the equivalent of a key "description123" for a recid of 123.
>>> 
>>> So you are asking for the value in the array at place (key) foo, when having stored it at place (as key) bar. Or the reverse :)
>> 
>> _______________________________________________
>> FX.php_List mailing list
>> FX.php_List at mail.iviking.org
>> http://www.iviking.org/mailman/listinfo/fx.php_list
> 
> 
> 
> -|
> 
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list



More information about the FX.php_List mailing list