Categories > TinyButStrong general >

Problem while merging an array... (err:sub-item 'id' is not an existing key in the array)

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: KarIst
Date: 2006-01-25
Time: 12:44

Problem while merging an array... (err:sub-item 'id' is not an existing key in the array)

Hello Skrol!

Please help me!
I've got problem while merging an array... (err:sub-item 'id' is not an existing key in the array)
//-------------
PHP side:
$tomb=$_SESSION['cart'];// one value in the variable $_SESSION['cart']['item'][1]='cucc';...

$TBS->MergeBlock('bk','array','tomb');

//-------------
HTML side:
[bk.id.val;block=tr;]

in PHP: echo vardump($tomb); result this:
array(5) { ["id"]=> array(1) { [0]=> string(2) "67" } ["kep"]=> array(1) { [0]=> string(13) "kis_szett.jpg" } ["termeknev"]=> array(1) { [0]=> string(9) "Kis Szett" } ["alapar"]=> array(1) { [0]=> string(4) "3990" } ["darab"]=> array(1) { [0]=> string(1) "1" } }

but TBS error occured:

"(Array value): Can't merge [bk.id.val] because sub-item 'id' is not an existing key in the array. "

I don't know what is it...

Thank you!
KarIst.
By: KarIst
Date: 2006-01-31
Time: 08:32

Re: Problem while merging an array... (err:sub-item 'id' is not an existing key in the array)

No answer? :(

My question is stupid?

KarIst.
By: Tom
Date: 2006-01-31
Time: 14:11

Re: Problem while merging an array... (err:sub-item 'id' is not an existing key in the array)

Try:
$TBS->MergeBlock(bk,$tomb);

with
[bk.id;block=tr]
By: Skrol29
Date: 2006-01-31
Time: 23:44

Re: Problem while merging an array... (err:sub-item 'id' is not an existing key in the array)

Hello,

Sorry, i've by-passed your post.

The be merged, an array should hab the following strutcure:
  $arr[item_a] = array ('col1'=>val1a, 'col2'=>val2a, ...)
  $arr[item_b] = array ('col1'=>val1b, 'col2'=>val2b, ...)

Or, when using virual columns 'key' and 'val', the array shoul have the structure :
  $arr = array('key1'=>'val1', 'key2'=>val2,...)

And you're not in this two cases.
Regarding to your array, I suggest that you try the following:
$TBS->MergeBlock('bk','array','tomb[id]');
HTML:
[bk.val;block=tr]
But it will always display only one cell, or none.
By: KarIst
Date: 2006-02-01
Time: 09:36

Re: Problem while merging an array... (err:sub-item 'id' is not an existing key in the array)

The answer is better later, than never! :)

Thank you Skrol29!