Categories > TinyButStrong general >

How to Convert a Block into an Array

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: MarceloReborn
Date: 2009-10-22
Time: 21:38

How to Convert a Block into an Array

Hello,

I have a mssql query, I merge it, and take the Block to HTML template, ok.

But I need to use the same result into PHP, and I don't wanna use a mssql_query() and lose performance.

if I try this:
$TBS->MergeBlock('blk_teste', $cnx_mssql_id, $sql_result);

print_r($blk_teste); // error because it isn't an array!
By: TomH
Date: 2009-10-22
Time: 23:24

Re: How to Convert a Block into an Array

Maybe there's more to your PHP code that I don't see in your post... but the variable $blk_teste doesn't exist in PHP does it?

I assume the print_r() statement is there just to see what's in the variable - you wouldn't do that in a real TBS situation.

Maybe you meant to do...
print_r($sql_result,true);

Anyway, say what you are trying to do with the result in PHP, please.
By: Skrol29
Date: 2009-10-23
Time: 00:23

Re: How to Convert a Block into an Array

Hi Marcelo,

Is this what you need ?
$data = $TBS->MergeBlock('blk_teste,*', $cnx_mssql_id, $sql_result);

print_r($data);
Use the '*' to ask MergeBlock to return the data.
By: MarceloReborn
Date: 2009-10-23
Time: 16:15

Re: How to Convert a Block into an Array

Skrol29,

Thanks!

Was exactly this.